  
/****** Object:  UserDefinedFunction [dbo].[ConvertTime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[ConvertTime](@eval int)

	RETURNS Nvarchar(5)
AS  

begin
	 	DECLARE @rval  Nvarchar(5)
		if @eval>0 
	begin
		SELECT  @rval = replicate('0',2-len(@eval/60))+ cast(@eval/60 as Nvarchar(2))+':'+replicate('0',2-len(@eval%60))+cast(@eval%60 as Nvarchar(2))
	end
	else
	begin
		SELECT  @rval=''
	end
		RETURN  @rval
 		 
end


GO
/****** Object:  UserDefinedFunction [dbo].[DayOfWeek]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[DayOfWeek](@dtDate DATETIME)
RETURNS NVARCHAR(10)
AS
BEGIN
DECLARE @rtDayofWeek NVARCHAR(10)
SELECT @rtDayofWeek = CASE DATEPART(weekday,@dtDate)
WHEN 1 THEN 'Sunday'
WHEN 2 THEN 'Monday'
WHEN 3 THEN 'Tuesday'
WHEN 4 THEN 'Wednesday'
WHEN 5 THEN 'Thursday'
WHEN 6 THEN 'Friday'
WHEN 7 THEN 'Saturday'
END
RETURN (@rtDayofWeek)
END


GO
/****** Object:  UserDefinedFunction [dbo].[FmtTime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE function [dbo].[FmtTime](@TimeValue Nvarchar(11)) returns Nvarchar(10)
as
begin
declare @FormatedTime Nvarchar(10)
select @FormatedTime=substring(convert(Nvarchar(5),@TimeValue),1,charindex('.',convert(Nvarchar(6),@TimeValue))-1) +':'+substring(convert(Nvarchar(5),@TimeValue),charindex('.',convert(Nvarchar(6),@TimeValue))+1,20)
return @FormatedTime
end


GO
/****** Object:  UserDefinedFunction [dbo].[SplitString]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create FUNCTION [dbo].[SplitString]  
(      
      @Input NVARCHAR(MAX),  
      @Character CHAR(1)  
)  
RETURNS @Output TABLE (  
      Item NVARCHAR(1000)  
)  
AS  
BEGIN  
      DECLARE @StartIndex INT, @EndIndex INT  
   
      SET @StartIndex = 1  
      IF SUBSTRING(@Input, LEN(@Input) - 1, LEN(@Input)) <> @Character  
      BEGIN  
            SET @Input = @Input + @Character  
      END  
   
      WHILE CHARINDEX(@Character, @Input) > 0  
      BEGIN  
            SET @EndIndex = CHARINDEX(@Character, @Input)  
             
            INSERT INTO @Output(Item)  
            SELECT SUBSTRING(@Input, @StartIndex, @EndIndex - 1)  
             
            SET @Input = SUBSTRING(@Input, @EndIndex + 1, LEN(@Input))  
      END  
   
      RETURN  
END

GO
/****** Object:  Table [dbo].[ActivityList]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ActivityList](
	[ActivityID] [int] IDENTITY(1,1) NOT NULL,
	[ActivityName] [nvarchar](120) NULL,
	[ActivityAddress] [nvarchar](300) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[All_In_Out_Table]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[All_In_Out_Table](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[srno] [int] NULL,
	[Cardno] [nvarchar](10) NOT NULL,
	[OfficeDate] [datetime] NULL,
	[InTime] [datetime] NULL,
	[OutTime] [datetime] NULL,
	[TotalDur] [datetime] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Attendance]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Attendance](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[E_Code] [nvarchar](10) NULL,
	[Punchtime] [datetime] NULL,
	[PunchType] [nvarchar](2) NULL,
	[Flag_Value] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[BreakDetails]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BreakDetails](
	[Empid] [int] NULL,
	[DateOffice] [datetime] NULL,
	[Break1In] [datetime] NULL,
	[Break2in] [datetime] NULL,
	[Break1Out] [datetime] NULL,
	[Break2Out] [datetime] NULL,
	[ShiftCode] [nvarchar](10) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[BreakTable]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BreakTable](
	[Empcode] [nvarchar](10) NOT NULL,
	[Empname] [nvarchar](50) NOT NULL,
	[T1] [nchar](5) NULL,
	[OfficeDate] [nchar](10) NULL,
	[TotalEMp] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[BreakTable1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BreakTable1](
	[Empcode] [nvarchar](10) NOT NULL,
	[Empname] [nvarchar](50) NOT NULL,
	[T1] [nchar](5) NULL,
	[OfficeDate] [nchar](10) NULL,
	[TotalEMp] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[ClientList]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ClientList](
	[ClientID] [int] IDENTITY(1,1) NOT NULL,
	[ClientName] [nvarchar](200) NULL,
	[ClientAddress] [nvarchar](500) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[config]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[config](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[fdate] [nvarchar](500) NULL,
	[tDate] [nvarchar](500) NULL,
	[Totalemployee] [nvarchar](200) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[GprReportRowData]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GprReportRowData](
	[Cardno] [nvarchar](10) NULL,
	[PunchdateTIme1] [datetime] NULL,
	[PunchdateTIme2] [datetime] NULL,
	[Location1] [nvarchar](500) NULL,
	[Location2] [nvarchar](500) NULL,
	[Lan1] [decimal](18, 8) NULL,
	[Log1] [decimal](18, 8) NULL,
	[Lan2] [decimal](18, 8) NULL,
	[Log2] [decimal](18, 8) NULL,
	[dur] [nvarchar](10) NULL,
	[Distance] [decimal](18, 8) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[GprReportRowData1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[GprReportRowData1](
	[Cardno] [nvarchar](10) NULL,
	[PunchdateTIme1] [datetime] NULL,
	[PunchdateTIme2] [datetime] NULL,
	[Location1] [nvarchar](500) NULL,
	[Location2] [nvarchar](500) NULL,
	[Lan1] [decimal](18, 8) NULL,
	[Log1] [decimal](18, 8) NULL,
	[Lan2] [decimal](18, 8) NULL,
	[Log2] [decimal](18, 8) NULL,
	[dur] [nvarchar](10) NULL,
	[Distance] [decimal](18, 8) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[IIWOtype]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[IIWOtype](
	[IIWOTypeId] [int] IDENTITY(1,1) NOT NULL,
	[IIWOTypeName] [nvarchar](50) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[LeaveIncash]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[LeaveIncash](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[LeaveID] [int] NULL,
	[Empid] [int] NULL,
	[LeaveCode] [nvarchar](20) NULL,
	[LeaveYear] [int] NULL,
	[LeaveInCash] [decimal](18, 2) NULL,
	[Date1] [datetime] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Loan_Transaction]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Loan_Transaction](
	[TranId] [int] IDENTITY(1,1) NOT NULL,
	[Empid] [int] NULL,
	[on_Date] [datetime] NULL,
	[AMount] [decimal](10, 2) NULL,
	[LoanId] [int] NULL,
	[ISpaid] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Log]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Log](
	[Year] [int] NULL,
	[Month] [nvarchar](10) NULL,
	[Amount] [decimal](18, 0) NULL,
	[AuditType] [nchar](1) NULL,
	[UniqueID] [int] NULL,
	[date] [datetime] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Log_Report]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Log_Report](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[UserName] [nvarchar](100) NULL,
	[UserType] [nvarchar](50) NULL,
	[On_Date] [datetime] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Machinenos]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Machinenos](
	[MachineNo] [nvarchar](5) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[mail_confi]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[mail_confi](
	[sender_mail] [nvarchar](500) NULL,
	[mobile_notification] [nvarchar](500) NULL,
	[time_setting] [nvarchar](1) NULL,
	[activestate] [int] NULL,
	[daily_attandancestate] [int] NULL,
	[daily_presentstate] [int] NULL,
	[daily_absentstate] [int] NULL,
	[date_email] [nvarchar](10) NULL,
	[monthly_absentstate] [int] NULL,
	[monthly_presentstate] [int] NULL,
	[monthly_attandancestate] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Map_UserCompany]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Map_UserCompany](
	[CompanyId] [int] NOT NULL,
	[UserId] [int] NOT NULL,
 CONSTRAINT [PK_Map_UserCompany] PRIMARY KEY CLUSTERED 
(
	[CompanyId] ASC,
	[UserId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[misspunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[misspunch](
	[cardno] [nvarchar](10) NOT NULL,
	[PunchDate] [nvarchar](30) NULL,
	[Mispunch] [nvarchar](1) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[MonthlySummaryTable]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MonthlySummaryTable](
	[Empcode] [nvarchar](10) NOT NULL,
	[Empname] [nvarchar](50) NOT NULL,
	[DateOffice] [nchar](10) NULL,
	[Tea1Out] [nchar](5) NULL,
	[Tea1In] [nchar](5) NULL,
	[Tea1Min] [int] NULL,
	[Tea2Out] [smalldatetime] NULL,
	[Tea2in] [smalldatetime] NULL,
	[Tea2min] [int] NULL,
	[LunchOut] [nchar](5) NULL,
	[Lunchin] [nchar](5) NULL,
	[LunchMin] [int] NULL,
	[Od1Out] [nchar](6) NULL,
	[OD1In] [nchar](5) NULL,
	[Od1Min] [int] NULL,
	[TotalTeaDur] [int] NULL,
	[TotallunchDur] [int] NULL,
	[TotalODDur] [int] NULL,
	[EmployeeID] [int] IDENTITY(1,1) NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[EmployeeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[mst_All_in_out]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[mst_All_in_out](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[DateOffice] [datetime] NULL,
	[Empid] [int] NULL,
	[In1] [datetime] NULL,
	[Out1] [datetime] NULL,
	[In2] [datetime] NULL,
	[Out2] [datetime] NULL,
	[In3] [datetime] NULL,
	[Out3] [datetime] NULL,
	[In4] [datetime] NULL,
	[Out4] [datetime] NULL,
	[In5] [datetime] NULL,
	[Out5] [datetime] NULL,
	[In6] [datetime] NULL,
	[Out6] [datetime] NULL,
	[In7] [datetime] NULL,
	[Out7] [datetime] NULL,
	[In8] [datetime] NULL,
	[Out8] [datetime] NULL,
	[In9] [datetime] NULL,
	[Out9] [datetime] NULL,
	[In10] [datetime] NULL,
	[Out10] [datetime] NULL,
	[In11] [datetime] NULL,
	[Out11] [datetime] NULL,
	[In12] [datetime] NULL,
	[Out12] [datetime] NULL,
	[In13] [datetime] NULL,
	[Out13] [datetime] NULL,
	[In14] [datetime] NULL,
	[Out14] [datetime] NULL,
	[In15] [datetime] NULL,
	[out15] [datetime] NULL,
	[In16] [datetime] NULL,
	[Out16] [datetime] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Bank]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Bank](
	[BankID] [int] IDENTITY(1,1) NOT NULL,
	[Bank_Name] [nvarchar](50) NOT NULL,
	[Bank_Description] [nvarchar](100) NULL,
	[Active] [bit] NULL,
	[On_Date] [smalldatetime] NULL,
	[By_User] [int] NULL,
 CONSTRAINT [PK_Mst_Bank] PRIMARY KEY CLUSTERED 
(
	[BankID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Branch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Branch](
	[BranchId] [int] IDENTITY(1,1) NOT NULL,
	[Branch_Name] [nvarchar](100) NOT NULL,
	[Address] [nvarchar](200) NOT NULL,
	[PhoneNo] [nvarchar](100) NOT NULL,
	[EmailId] [nvarchar](50) NOT NULL,
	[Active] [bit] NULL CONSTRAINT [DF_Mst_Branch_Active]  DEFAULT ((1)),
	[On_Date] [smalldatetime] NULL CONSTRAINT [DF_Mst_Branch_On_Date]  DEFAULT (getdate()),
	[By_User] [int] NULL,
	[CompanyId] [int] NULL,
 CONSTRAINT [PK_Mst_Branch] PRIMARY KEY CLUSTERED 
(
	[BranchId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Company]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Company](
	[CompanyId] [int] IDENTITY(1,1) NOT NULL,
	[CompanyName] [nvarchar](100) NOT NULL,
	[Description] [nvarchar](150) NOT NULL,
	[Address] [nvarchar](250) NOT NULL CONSTRAINT [DF_Mst_Company_Address]  DEFAULT (''),
	[PhoneNo] [nvarchar](50) NOT NULL CONSTRAINT [DF_Mst_Company_PhoneNo]  DEFAULT (''),
	[EmailId] [nvarchar](50) NULL CONSTRAINT [DF_Mst_Company_EmailId]  DEFAULT (''),
	[Vat_No] [nvarchar](20) NULL,
	[Pf_No] [nvarchar](20) NULL,
	[Tan_No] [nvarchar](20) NULL,
	[Reg_No] [nvarchar](20) NULL,
	[Esi_No] [nvarchar](20) NULL,
	[Pan_No] [nvarchar](20) NULL,
	[PF] [numeric](6, 2) NOT NULL CONSTRAINT [DF_Mst_Company_PF]  DEFAULT ((0)),
	[FPF] [numeric](6, 2) NOT NULL CONSTRAINT [DF_Mst_Company_FPF]  DEFAULT ((0)),
	[PPF] [numeric](18, 2) NULL,
	[ESI] [numeric](6, 2) NOT NULL CONSTRAINT [DF_Mst_Company_ESI]  DEFAULT ((0)),
	[Addition1] [nvarchar](30) NOT NULL CONSTRAINT [DF_Mst_Company_Addition1]  DEFAULT (''),
	[Addition2] [nvarchar](30) NOT NULL CONSTRAINT [DF_Mst_Company_Addition11]  DEFAULT (''),
	[Addition3] [nvarchar](30) NOT NULL CONSTRAINT [DF_Mst_Company_Addition12]  DEFAULT (''),
	[Addition4] [nvarchar](30) NOT NULL CONSTRAINT [DF_Mst_Company_Addition13]  DEFAULT (''),
	[Addition5] [nvarchar](30) NOT NULL CONSTRAINT [DF_Mst_Company_Addition14]  DEFAULT (''),
	[Addition6] [nvarchar](50) NULL,
	[Addition7] [nvarchar](50) NULL,
	[Addition8] [nvarchar](50) NULL,
	[Addition9] [nvarchar](50) NULL,
	[Addition10] [nvarchar](50) NULL,
	[Ded1] [nvarchar](30) NOT NULL CONSTRAINT [DF_Mst_Company_Ded1]  DEFAULT (''),
	[Ded2] [nvarchar](30) NOT NULL CONSTRAINT [DF_Mst_Company_Ded2]  DEFAULT (''),
	[Ded3] [nvarchar](30) NOT NULL CONSTRAINT [DF_Mst_Company_Dec3]  DEFAULT (''),
	[Ded4] [nvarchar](50) NULL,
	[Ded5] [nvarchar](50) NULL,
	[FDed1] [nvarchar](50) NULL,
	[FDed2] [nvarchar](50) NULL,
	[FDed3] [nvarchar](50) NULL,
	[FDed4] [nvarchar](50) NULL,
	[FDed5] [nvarchar](50) NULL,
	[Active] [bit] NULL CONSTRAINT [DF_Mst_Company_Active]  DEFAULT ((1)),
	[On_Date] [smalldatetime] NULL CONSTRAINT [DF_Mst_Company_On_Date]  DEFAULT (getdate()),
	[By_User] [int] NULL,
 CONSTRAINT [PK_Mst_Company] PRIMARY KEY CLUSTERED 
(
	[CompanyId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_CorpPolicy]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_CorpPolicy](
	[DuplidatePunchMin] [numeric](6, 2) NOT NULL,
	[MaxEarlyComming] [numeric](6, 2) NOT NULL,
	[MaxLateGoing] [numeric](6, 2) NOT NULL,
	[MinPresentForWO] [numeric](6, 2) NOT NULL,
	[AWAasAAA] [bit] NOT NULL CONSTRAINT [DF_Mst_CorpPolicy_AWAasAAA]  DEFAULT ((0)),
	[OTFormula] [int] NOT NULL CONSTRAINT [DF_Mst_CorpPolicy_OTFormula]  DEFAULT ((0)),
	[WorkHRCalc] [tinyint] NOT NULL CONSTRAINT [DF_Mst_CorpPolicy_WorkHRCalc]  DEFAULT ((2)),
	[ShowPayroll] [bit] NOT NULL CONSTRAINT [DF_Mst_CorpPolicy_ShowPayroll]  DEFAULT ((1)),
	[absentonsinglePunch] [nvarchar](50) NULL,
	[SalCalMode] [bit] NULL,
	[CorpPolicyid] [int] IDENTITY(1,1) NOT NULL,
	[PolicyName] [nvarchar](50) NOT NULL DEFAULT ('Gen')
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Dates]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Dates](
	[RowId] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
	[MDate] [smalldatetime] NOT NULL,
	[Process] [nchar](1) NULL,
	[IsProcess] [bit] NULL,
 CONSTRAINT [PK_Mst_Dates] PRIMARY KEY CLUSTERED 
(
	[MDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Department]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Department](
	[DeptId] [int] IDENTITY(1,1) NOT NULL,
	[Dept_Name] [nvarchar](100) NULL,
	[Dept_Description] [nvarchar](150) NULL,
	[Active] [bit] NULL CONSTRAINT [DF_Mst_Dept_Active]  DEFAULT ((1)),
	[On_Date] [smalldatetime] NULL CONSTRAINT [DF_Mst_Dept_On_Date]  DEFAULT (getdate()),
	[By_User] [int] NULL,
 CONSTRAINT [PK_Mst_Dept] PRIMARY KEY CLUSTERED 
(
	[DeptId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Designation]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Designation](
	[DesigId] [int] IDENTITY(1,1) NOT NULL,
	[Desig_Name] [nvarchar](200) NOT NULL,
	[Desig_Description] [nvarchar](100) NULL,
	[Active] [bit] NOT NULL CONSTRAINT [DF_Mst_Desig_Active]  DEFAULT ((1)),
	[On_Date] [smalldatetime] NULL CONSTRAINT [DF_Mst_Desig_On_Date]  DEFAULT (getdate()),
	[By_User] [int] NULL,
 CONSTRAINT [PK_Mst_Desig] PRIMARY KEY CLUSTERED 
(
	[DesigId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Email]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Email](
	[Uname] [nvarchar](100) NULL,
	[pwd] [nvarchar](100) NULL,
	[fAddress] [nvarchar](100) NULL,
	[SmptAddress] [nvarchar](100) NULL,
	[port] [nvarchar](8) NULL,
	[ssl] [nchar](10) NULL,
	[toaddress] [nvarchar](100) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Employee]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Mst_Employee](
	[EmpId] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
	[EmpName] [nvarchar](50) NOT NULL,
	[FatherName] [nvarchar](50) NOT NULL,
	[EmpCode] [nvarchar](10) NOT NULL,
	[pwd] [nvarchar](50) NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[CompanyId] [int] NOT NULL,
	[DeptId] [int] NOT NULL,
	[DesigId] [int] NOT NULL,
	[BranchId] [int] NOT NULL,
	[OTimePoliceId] [int] NOT NULL,
	[DateofJoin] [smalldatetime] NULL,
	[ReginDate] [nvarchar](50) NOT NULL,
	[SuperiourName] [int] NULL,
	[ShiftId] [int] NULL,
	[ShiftType] [nvarchar](10) NULL,
	[ShiftPatternId] [nvarchar](50) NULL,
	[IsAutoShift] [bit] NULL,
	[Auto_Shifts] [nvarchar](50) NULL,
	[FirstOffDay] [nchar](15) NULL,
	[SecondOffDayType] [nvarchar](15) NULL,
	[SecondOffDay] [nchar](15) NULL,
	[HalfDayShiftId] [int] NULL,
	[SecondWeekOffDays] [nvarchar](20) NULL,
	[ShiftRemaindays] [int] NULL,
	[CDays] [int] NULL,
	[ShiftStartDate] [smalldatetime] NULL,
	[ShiftCode] [nchar](3) NULL CONSTRAINT [DF_Mst_Employee_ShiftCode]  DEFAULT (''),
	[HalfDayShiftCode] [nchar](3) NULL CONSTRAINT [DF_Mst_Employee_HalfDayShiftCode]  DEFAULT (''),
	[ImagePath] [nvarchar](500) NULL,
	[active] [bit] NULL CONSTRAINT [DF_Mst_Employee_active]  DEFAULT ((1)),
	[On_Date] [smalldatetime] NULL CONSTRAINT [DF_Mst_Employee_On_Date]  DEFAULT (getdate()),
	[By_User] [int] NULL,
	[EmailAddress] [nvarchar](150) NULL,
	[BSalary] [nvarchar](50) NULL,
	[LeaveActive] [bit] NULL,
	[LaveBalance] [nvarchar](7) NULL,
	[PhoneNo] [nvarchar](50) NULL,
	[ProfilePic] [image] NULL,
	[CorpPolicyid] [int] NOT NULL DEFAULT ((1)),
	[DateofBirth] [datetime] NULL,
	[GPSActive] [int] NULL DEFAULT ((0)),
	[cardno1] [nvarchar](10) NULL,
	[Validitystart] [datetime] NULL,
	[Validityend] [datetime] NULL,
	[WeekTimeZone] [int] NULL,
	[WeekTimeZone2] [int] NULL,
	[WeekTimeZone3] [int] NULL,
	[WeekTimeZone4] [int] NULL,
	[EAddress] [varchar](400) NULL,
	[DeviceToken] [varchar](max) NULL,
	[type] [int] NULL,
	[adminnotification] [int] NULL,
	[empDeviceToken] [varchar](400) NULL,
	[AdminDeviceToken] [varchar](400) NULL,
	[TourAmt] [varchar](10) NULL,
 CONSTRAINT [PK_Mst_Employee] PRIMARY KEY CLUSTERED 
(
	[EmpId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Mst_EmploymentType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_EmploymentType](
	[EmploymentTypeId] [int] IDENTITY(1,1) NOT NULL,
	[EmploymentTypeName] [nvarchar](50) NOT NULL,
	[EmploymentTypeDesc] [nvarchar](100) NOT NULL,
	[Active] [bit] NULL,
	[On_Date] [smalldatetime] NULL,
	[By_User] [int] NULL,
 CONSTRAINT [PK_Mst_EmploymentType] PRIMARY KEY CLUSTERED 
(
	[EmploymentTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_EmpOfficeTime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_EmpOfficeTime](
	[OTimePoliceId] [int] IDENTITY(1,1) NOT NULL,
	[OfficeTimePolicyName] [nvarchar](40) NOT NULL,
	[LateHour] [numeric](6, 2) NOT NULL,
	[EarlyHour] [numeric](6, 2) NOT NULL,
	[DayMaxworkHour] [numeric](6, 2) NOT NULL,
	[PresentDuration] [numeric](6, 2) NOT NULL,
	[HalfDayWorkHour] [numeric](6, 2) NOT NULL,
	[HalfDayAbsentHour] [numeric](6, 2) NOT NULL,
	[RoundClock] [bit] NOT NULL,
	[TimeLoss] [bit] NOT NULL,
	[HalfDay] [bit] NOT NULL,
	[ShortLeave] [bit] NOT NULL,
	[OverStay] [bit] NOT NULL,
	[OverTime] [bit] NOT NULL,
	[OTRate] [numeric](8, 2) NOT NULL,
	[RequiredPunch] [smallint] NOT NULL,
	[SinglePunchValue] [numeric](8, 0) NOT NULL,
	[On_Date] [smalldatetime] NULL CONSTRAINT [DF_Mst_EmpOfficeTime_On_Date]  DEFAULT (getdate()),
	[By_User] [int] NULL,
	[LateSettingEnable] [bit] NULL,
	[NoOfLateInAMonth] [int] NULL,
	[MarkifLate] [text] NULL,
	[LateTime] [text] NULL,
	[EnableShowLunchAsOt] [bit] NULL,
	[ShowLunchAsOtTime] [nvarchar](10) NULL,
	[LateArrival] [nvarchar](10) NOT NULL DEFAULT ('00:00'),
	[Showforlate] [int] NOT NULL DEFAULT ((0)),
	[EarlyDept] [nvarchar](10) NOT NULL DEFAULT ('00:00'),
	[Showforealry] [int] NOT NULL DEFAULT ((0)),
	[AttendanceType] [int] NULL DEFAULT ((1)),
	[chkhrsinday] [int] NULL,
	[hrsforday] [nvarchar](10) NULL,
	[hrsinday] [int] NULL,
	[Maxotintmonth] [nvarchar](10) NULL,
	[maxotsetting] [int] NULL,
	[IgnoreOTSetting] [nvarchar](3000) NULL,
	[cl] [int] NULL,
 CONSTRAINT [PK_Mst_EmpOfficeTime] PRIMARY KEY CLUSTERED 
(
	[OTimePoliceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Grade]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Grade](
	[GradeId] [int] IDENTITY(1,1) NOT NULL,
	[Grade_Nme] [nvarchar](50) NOT NULL,
	[Grade_Description] [nvarchar](100) NULL,
	[Active] [bit] NOT NULL,
	[On_Date] [smalldatetime] NULL,
	[By_User] [int] NULL,
 CONSTRAINT [PK_Mst_Grade_1] PRIMARY KEY CLUSTERED 
(
	[GradeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Holiday]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Holiday](
	[HolidayId] [int] IDENTITY(1,1) NOT NULL,
	[HolidayName] [nvarchar](50) NULL,
	[HolidayDate] [smalldatetime] NULL,
	[CompId] [int] NULL,
	[Description] [nvarchar](100) NOT NULL,
	[IsAdjustment] [bit] NULL,
	[AdjustmentDate] [smalldatetime] NULL,
	[On_Date] [smalldatetime] NULL,
	[By_User] [int] NULL,
	[empid] [xml] NULL,
 CONSTRAINT [PK_Mst_Holiday] PRIMARY KEY CLUSTERED 
(
	[HolidayId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_LeaveApplication]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_LeaveApplication](
	[RwId] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
	[EmpId] [nvarchar](50) NULL,
	[Fromdate] [smalldatetime] NULL,
	[Todate] [smalldatetime] NULL,
	[Reason] [nvarchar](max) NULL,
	[Leaveid] [int] NULL,
	[Dur1] [nvarchar](20) NULL,
	[Dur2] [nvarchar](20) NULL,
	[Dur3] [nvarchar](20) NULL,
	[Dur4] [nvarchar](20) NULL,
	[ApprovedStatus] [nvarchar](25) NULL,
	[ApprovedBy] [int] NULL,
	[ApplicationDate] [smalldatetime] NULL,
	[Remark] [nvarchar](50) NULL,
	[ApprovedDate] [smalldatetime] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_LeaveOpening]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_LeaveOpening](
	[EmpId] [numeric](18, 0) NOT NULL,
	[LeaveTypeId] [int] NOT NULL,
	[YearNo] [int] NOT NULL,
	[Opening] [numeric](6, 2) NULL,
	[LtypeCode] [nvarchar](10) NULL,
	[ispaid] [int] NULL,
 CONSTRAINT [PK_Mst_LeaveOpening] PRIMARY KEY CLUSTERED 
(
	[EmpId] ASC,
	[LeaveTypeId] ASC,
	[YearNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_LeaveType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_LeaveType](
	[LeaveTypeId] [int] IDENTITY(1,1) NOT NULL,
	[LTypeCode] [nvarchar](20) NOT NULL,
	[LTypeName] [nvarchar](50) NOT NULL,
	[WeekOff] [bit] NOT NULL,
	[Holiday] [bit] NOT NULL,
	[IsAccrual] [bit] NOT NULL,
	[AccrualType] [nvarchar](50) NOT NULL,
	[Fixmin] [decimal](6, 2) NOT NULL,
	[Fixmax] [decimal](6, 2) NOT NULL,
	[CarryPresent] [decimal](6, 2) NOT NULL,
	[CarryLeave] [decimal](6, 2) NOT NULL,
	[MaxAccrual] [decimal](6, 2) NOT NULL,
	[Paid] [bit] NULL,
	[On_Date] [smalldatetime] NULL,
	[By_User] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[MSt_Loan]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MSt_Loan](
	[LoanId] [int] IDENTITY(1,1) NOT NULL,
	[Loan_Name] [nvarchar](150) NULL,
	[Loan_Type] [nvarchar](200) NULL,
	[EmpId] [int] NULL,
	[Term] [int] NULL,
	[Amount] [decimal](10, 2) NULL,
	[IntRate] [decimal](3, 2) NULL,
	[StartFrom] [datetime] NULL,
	[TotalAmount] [decimal](10, 2) NULL,
	[on_Date] [datetime] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_MachineType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_MachineType](
	[McTypeId] [int] IDENTITY(1,1) NOT NULL,
	[McTypeName] [nvarchar](50) NOT NULL,
	[PortNo] [int] NOT NULL,
 CONSTRAINT [PK_Mst_MachineType] PRIMARY KEY CLUSTERED 
(
	[McTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[mst_machineType1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[mst_machineType1](
	[MachineId] [int] IDENTITY(1,1) NOT NULL,
	[MachineNo] [varchar](100) NULL,
	[MachineType] [varchar](300) NULL,
	[MachineIp] [nvarchar](50) NULL,
	[Port] [nvarchar](50) NULL,
	[pwd] [varchar](50) NULL,
	[BranchId] [int] NULL,
	[UserId] [int] NULL,
	[IsDyndns] [varchar](50) NULL,
	[TimeZone1] [varchar](250) NULL,
	[In_out] [varchar](20) NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Mst_News]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_News](
	[NewsId] [int] IDENTITY(1,1) NOT NULL,
	[NewsText] [nvarchar](1000) NULL,
	[BranchId] [nvarchar](1000) NULL,
	[NewsStart_Date] [datetime] NULL,
	[New_EndDate] [datetime] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_SalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_SalaryDetail](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[EmpId] [numeric](18, 0) NOT NULL,
	[Addition1] [numeric](10, 2) NOT NULL,
	[Addition2] [numeric](10, 2) NOT NULL,
	[Addition3] [numeric](10, 2) NOT NULL,
	[Addition4] [numeric](10, 2) NOT NULL,
	[Addition5] [numeric](10, 2) NULL,
	[Addition6] [numeric](10, 2) NULL,
	[Addition7] [numeric](10, 2) NULL,
	[Addition8] [numeric](10, 2) NULL,
	[Addition9] [numeric](10, 2) NULL,
	[Addition10] [numeric](10, 2) NULL,
	[Sub1] [numeric](10, 2) NOT NULL,
	[Sub2] [numeric](10, 2) NULL,
	[Sub3] [numeric](10, 2) NOT NULL,
	[Sub4] [numeric](10, 2) NULL,
	[Sub5] [numeric](10, 2) NULL,
	[FDed1] [numeric](10, 2) NULL,
	[FDed2] [numeric](10, 2) NULL,
	[FDed3] [numeric](10, 2) NULL,
	[FDed4] [numeric](10, 2) NULL,
	[FDed5] [numeric](10, 2) NULL,
	[PFNo] [nvarchar](20) NOT NULL,
	[ESINO] [nvarchar](20) NOT NULL,
	[IsOvertime] [bit] NOT NULL,
	[IsDayRate] [int] NOT NULL,
	[IsEsi1] [bit] NULL,
	[IsPF1] [bit] NULL,
	[IsOt1] [bit] NULL,
	[IsEsi2] [bit] NULL,
	[IsPf2] [bit] NULL,
	[IsOt2] [bit] NULL,
	[IsEsi3] [bit] NULL,
	[IsPf3] [bit] NULL,
	[IsOt3] [bit] NULL,
	[IsEsi4] [bit] NULL,
	[IsPf4] [bit] NULL,
	[IsOt4] [bit] NULL,
	[IsEsi5] [bit] NULL,
	[IsPf5] [bit] NULL,
	[IsOt5] [bit] NULL,
	[IsEsi6] [bit] NULL,
	[IsPf6] [bit] NULL,
	[IsOt6] [bit] NULL,
	[IsEsi7] [bit] NULL,
	[IsPf7] [bit] NULL,
	[IsOt7] [bit] NULL,
	[IsEsi8] [bit] NULL,
	[IsPf8] [bit] NULL,
	[IsOt8] [bit] NULL,
	[IsEsi9] [bit] NULL,
	[IsPf9] [bit] NULL,
	[IsOt9] [bit] NULL,
	[IsEsi10] [bit] NULL,
	[IsPf10] [bit] NULL,
	[IsOt10] [bit] NULL,
	[Pf] [numeric](10, 2) NULL,
	[Epf] [numeric](10, 2) NULL,
	[PPF] [numeric](10, 2) NULL,
	[ESI] [numeric](10, 2) NULL,
	[OTRate] [numeric](10, 2) NULL,
	[TdsAmt] [numeric](10, 2) NULL,
	[TdsPer] [numeric](10, 2) NULL,
	[PfAmount] [numeric](10, 2) NULL,
	[IsPfamount] [bit] NULL,
 CONSTRAINT [PK_Mst_SalaryDetail] PRIMARY KEY CLUSTERED 
(
	[EmpId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Section]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Section](
	[SectionId] [int] IDENTITY(1,1) NOT NULL,
	[Section_Name] [nvarchar](50) NOT NULL,
	[Section_Description] [nvarchar](100) NULL,
	[Active] [bit] NULL,
	[On_Date] [smalldatetime] NULL,
	[By_User] [int] NULL,
 CONSTRAINT [PK_Mst_Section] PRIMARY KEY CLUSTERED 
(
	[SectionId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_Shift]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_Shift](
	[ShiftId] [int] IDENTITY(1,1) NOT NULL,
	[ShiftCode] [nvarchar](10) NOT NULL,
	[ShiftName] [nvarchar](25) NOT NULL,
	[StartTime] [numeric](6, 2) NOT NULL,
	[EndTime] [numeric](6, 2) NOT NULL,
	[ShiftDuration] [numeric](6, 2) NOT NULL,
	[Break1Begun] [numeric](6, 2) NOT NULL,
	[Break1End] [numeric](6, 2) NOT NULL,
	[Break1Duration] [numeric](6, 2) NULL,
	[Break2Begun] [numeric](6, 2) NULL,
	[Break2End] [numeric](6, 2) NULL,
	[Break2Duration] [numeric](6, 2) NULL,
	[LunchBegun] [numeric](6, 2) NULL,
	[LunchEnd] [numeric](6, 2) NULL,
	[LunchDur] [numeric](6, 2) NULL,
	[Active] [bit] NOT NULL CONSTRAINT [DF_Mst_Shift_Active]  DEFAULT ((1)),
	[On_Date] [smalldatetime] NOT NULL CONSTRAINT [DF_Mst_Shift_On_Date]  DEFAULT (getdate()),
	[By_User] [int] NULL,
	[Break3Begun] [numeric](6, 2) NULL,
	[Break3End] [numeric](6, 2) NULL,
	[Break3Duration] [numeric](6, 2) NULL,
	[Break4Begun] [numeric](6, 2) NULL,
	[Break4End] [numeric](6, 2) NULL,
	[Break4Duration] [numeric](6, 2) NULL,
	[Break5Begun] [numeric](6, 2) NULL,
	[Break5End] [numeric](6, 2) NULL,
	[Break5Duration] [numeric](6, 2) NULL,
	[Break6Begun] [numeric](6, 2) NULL,
	[Break6End] [numeric](6, 2) NULL,
	[Break6Duration] [numeric](6, 2) NULL,
	[Break7Begun] [numeric](6, 2) NULL,
	[Break7End] [numeric](6, 2) NULL,
	[Break7Duration] [numeric](6, 2) NULL,
	[Break8Begun] [numeric](6, 2) NULL,
	[Break8End] [numeric](6, 2) NULL,
	[Break8Duration] [numeric](6, 2) NULL,
	[Break9Begun] [numeric](6, 2) NULL,
	[Break9End] [numeric](6, 2) NULL,
	[Break9Duration] [numeric](6, 2) NULL,
	[Break10Begun] [numeric](6, 2) NULL,
	[Break10End] [numeric](6, 2) NULL,
	[Break10Duration] [numeric](6, 2) NULL,
	[Break11Begun] [numeric](6, 2) NULL,
	[Break11End] [numeric](6, 2) NULL,
	[Break11Duration] [numeric](6, 2) NULL,
	[Break12Begun] [numeric](6, 2) NULL,
	[Break12End] [numeric](6, 2) NULL,
	[Break12Duration] [numeric](6, 2) NULL,
	[FirstOffDay] [nvarchar](50) NULL,
	[SecondOffDaytype] [nvarchar](50) NULL,
	[SecondOffDay] [nvarchar](50) NULL,
	[HalfDayShiftID] [nvarchar](50) NULL,
	[SecondWeekOffDays] [nvarchar](50) NULL,
	[DuplidatePunchMin] [numeric](6, 2) NOT NULL DEFAULT ((0.02)),
	[MaxEarlyComming] [numeric](6, 2) NOT NULL DEFAULT ((2.00)),
	[MaxLateGoing] [numeric](6, 2) NOT NULL DEFAULT ((5.0)),
	[MinPresentForWO] [numeric](6, 2) NOT NULL DEFAULT ((4.0)),
	[AWAasAAA] [bit] NOT NULL DEFAULT ((0)),
	[OTFormula] [int] NOT NULL DEFAULT ((0)),
	[WorkHRCalc] [tinyint] NOT NULL DEFAULT ((2)),
	[ShowPayroll] [bit] NOT NULL DEFAULT ((1)),
	[absentonsinglePunch] [nvarchar](50) NOT NULL DEFAULT ('0'),
	[SalCalMode] [bit] NOT NULL DEFAULT ((0)),
	[shifttype] [int] NULL,
	[Awaaslal] [int] NULL,
	[twoshiftinaday] [int] NULL,
 CONSTRAINT [PK_Mst_Shift] PRIMARY KEY CLUSTERED 
(
	[ShiftId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_SWPolicy]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Mst_SWPolicy](
	[SWPolicyId] [int] IDENTITY(1,1) NOT NULL,
	[PName] [nvarchar](50) NOT NULL,
	[ShiftId] [int] NOT NULL,
	[ShiftType] [nvarchar](10) NOT NULL,
	[ShiftPatternId] [nvarchar](50) NOT NULL,
	[IsAutoShift] [bit] NOT NULL,
	[Auth_Shifts] [nvarchar](50) NOT NULL,
	[FirstOffDay] [nchar](15) NULL,
	[SecondOffDayType] [nvarchar](5) NULL,
	[SecondOffDay] [nchar](15) NULL,
	[HalfDayShiftId] [int] NULL,
	[SecondWeekOffDays] [nvarchar](20) NOT NULL,
	[ShiftRemaindays] [int] NULL,
	[CDays] [int] NULL,
	[On_Date] [smalldatetime] NULL,
	[By_User] [int] NULL,
 CONSTRAINT [PK_Mst_SWPolicy] PRIMARY KEY CLUSTERED 
(
	[SWPolicyId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Mst_User]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Mst_User](
	[User_Id] [int] IDENTITY(1,1) NOT NULL,
	[User_Login_Id] [nvarchar](25) NOT NULL,
	[User_Name] [nvarchar](50) NOT NULL CONSTRAINT [DF_Mst_User_User_Name]  DEFAULT (''),
	[User_Password] [nvarchar](25) NOT NULL CONSTRAINT [DF_Mst_User_User_Password]  DEFAULT (''),
	[Parent_User_Id] [int] NULL,
	[User_Enabled] [bit] NOT NULL CONSTRAINT [DF_Mst_User_User_Enabled]  DEFAULT ((1)),
	[email] [nvarchar](50) NULL,
	[Mobile] [nvarchar](50) NULL,
	[On_Date] [smalldatetime] NOT NULL CONSTRAINT [DF_Mst_User_On_Date]  DEFAULT (getdate()),
	[Per] [nvarchar](255) NULL,
	[Branch_per] [nvarchar](4000) NULL,
	[Company_per] [nvarchar](4000) NULL,
	[Dept_per] [nvarchar](4000) NULL,
	[AllowAccess] [nvarchar](20) NULL,
	[leaveaccess] [nvarchar](20) NULL,
	[visitor_per] [int] NULL,
	[DeviceToken] [varchar](max) NULL,
	[type] [int] NULL,
	[adminnotification] [int] NULL,
 CONSTRAINT [PK_Mst_User] PRIMARY KEY CLUSTERED 
(
	[User_Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Notification]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Notification](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[Msg] [nvarchar](200) NULL,
	[Status] [int] NULL,
	[Punchdatetime] [datetime] NULL,
	[cardno] [nvarchar](20) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[ppt]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ppt](
	[cardno] [nvarchar](10) NOT NULL,
	[punchdatetime] [smalldatetime] NOT NULL,
	[p_day] [nchar](1) NOT NULL,
	[ismanual] [nchar](1) NOT NULL,
	[paycode] [nvarchar](50) NULL,
	[machineno] [nvarchar](5) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[ProjectAttendance]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ProjectAttendance](
	[RowID] [bigint] IDENTITY(1,1) NOT NULL,
	[ClientID] [int] NULL,
	[ProjectName] [nvarchar](500) NULL,
	[Activity] [nvarchar](500) NULL,
	[Brand] [nvarchar](500) NULL,
	[Div] [nvarchar](200) NULL,
	[Chageable] [nvarchar](100) NULL,
	[Date1] [datetime] NULL,
	[StartTime] [datetime] NULL,
	[EndTime] [datetime] NULL,
	[Empid] [int] NULL,
	[Empcode] [nvarchar](20) NULL,
	[Cardno] [nvarchar](8) NULL,
	[Status] [int] NULL,
	[Hrs] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[sharad121]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[sharad121](
	[CardNo] [nvarchar](10) NOT NULL,
	[PunchDatetime] [datetime] NOT NULL,
	[Process] [nchar](1) NULL,
	[MachineNo] [nvarchar](5) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[SHarad1211]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SHarad1211](
	[EmployeeName] [nvarchar](255) NULL,
	[FatherName] [nvarchar](255) NULL,
	[Paycode] [nvarchar](255) NULL,
	[CardNo] [nvarchar](255) NULL,
	[Email] [nvarchar](255) NULL,
	[Department] [nvarchar](255) NULL,
	[Designation] [nvarchar](255) NULL,
	[BranchName] [nvarchar](255) NULL,
	[OfficeTimePolicy] [nvarchar](255) NULL,
	[DateofJoin] [datetime] NULL,
	[ShiftCode] [nvarchar](255) NULL,
	[WeeklyOff] [nvarchar](255) NULL,
	[CompanyName] [nvarchar](255) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Sheet1$]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sheet1$](
	[Cardno] [nvarchar](10) NOT NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[ShiftType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ShiftType](
	[ShiftTypeId] [int] IDENTITY(1,1) NOT NULL,
	[ShiftTypeName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_ShiftType] PRIMARY KEY CLUSTERED 
(
	[ShiftTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[SMS_API]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SMS_API](
	[S_API] [nvarchar](4000) NULL,
	[SenderID] [nvarchar](50) NULL,
	[Uname] [nvarchar](25) NULL,
	[pwd] [nvarchar](50) NULL,
	[Active] [int] NULL,
	[inSms] [nvarchar](500) NULL,
	[OutSms] [nvarchar](500) NULL,
	[AbsentSms] [nvarchar](500) NULL,
	[instat] [int] NULL,
	[OutStat] [int] NULL,
	[AbsentStat] [int] NULL,
	[andriod_notification] [nvarchar](500) NULL,
	[andriodstate] [int] NULL,
	[LateStat] [int] NULL,
	[Latesms] [varchar](600) NULL,
	[chtemp] [varchar](10) NULL,
	[Smtp_Name] [varchar](150) NULL,
	[Smtp_port] [varchar](150) NULL,
	[Smtp_Email] [varchar](150) NULL,
	[smtp_pwd] [varchar](150) NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Sms_Setting]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sms_Setting](
	[SmsUrl] [nvarchar](4000) NULL,
	[SenderId] [nvarchar](200) NULL,
	[userNAme] [nvarchar](200) NULL,
	[pwd] [nvarchar](200) NULL,
	[Active] [bit] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[ss]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ss](
	[Tran_MachineRawPunchId] [int] NOT NULL,
	[EmpName] [nvarchar](50) NOT NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[PunchDate] [nvarchar](30) NULL,
	[PunchTime] [nvarchar](5) NULL,
	[P_Day] [nchar](1) NOT NULL,
	[Paycode] [nvarchar](10) NOT NULL,
	[MachineNo] [nvarchar](5) NULL,
	[isManual] [nchar](1) NOT NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[ss1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ss1](
	[EmployeeName] [nvarchar](255) NULL,
	[FatherName] [nvarchar](255) NULL,
	[Paycode] [nvarchar](255) NULL,
	[CardNo] [nvarchar](255) NULL,
	[Email] [nvarchar](255) NULL,
	[Department] [nvarchar](255) NULL,
	[Designation] [nvarchar](255) NULL,
	[BranchName] [nvarchar](255) NULL,
	[OfficeTimePolicy] [nvarchar](255) NULL,
	[DateofJoin] [datetime] NULL,
	[ShiftCode] [nvarchar](255) NULL,
	[WeeklyOff] [nvarchar](255) NULL,
	[CompanyName] [nvarchar](255) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Ta]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Ta](
	[Cardno] [nvarchar](10) NOT NULL,
	[PunchDateTime] [smalldatetime] NOT NULL,
	[p_Day] [nchar](1) NOT NULL,
	[IsManual] [nchar](1) NOT NULL,
	[Paycode] [nvarchar](50) NULL,
	[MachineNo] [nvarchar](5) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Table1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Table1](
	[inData] [smalldatetime] NULL,
	[Machineno] [nvarchar](5) NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[LocationIN] [nvarchar](100) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Table2]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Table2](
	[OutData] [smalldatetime] NULL,
	[Machineno] [nvarchar](5) NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[LocationOUT] [nvarchar](100) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[table3]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[table3](
	[PayCode] [nvarchar](10) NOT NULL,
	[Locationin] [nvarchar](100) NULL,
	[locationout] [nvarchar](100) NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[EmployeeName] [nvarchar](50) NOT NULL,
	[Shift] [nchar](3) NULL,
	[ShiftStartTime] [nvarchar](5) NULL,
	[InTime] [nvarchar](5) NULL,
	[LunchOut] [datetime] NULL,
	[LunchIn] [nchar](5) NULL,
	[OutTime] [nvarchar](7) NULL,
	[HoursWorks] [nvarchar](5) NULL,
	[Status] [nvarchar](20) NULL,
	[EarlyArrival] [nvarchar](5) NULL,
	[LateArrival] [nvarchar](5) NULL,
	[EarlyDeparture] [nvarchar](5) NULL,
	[ExcessLuncHour] [nvarchar](5) NULL,
	[OTDuration] [nvarchar](5) NULL,
	[OTAmount] [numeric](10, 2) NULL,
	[OverStay] [nvarchar](5) NULL,
	[Manual] [nvarchar](7) NULL,
	[Department] [nvarchar](100) NULL,
	[PerformanceDate] [nvarchar](30) NULL,
	[Leave] [nchar](3) NULL,
	[TOTALLOSSHRS] [int] NULL,
	[AccessLunch] [nchar](5) NULL,
	[BreakTime] [nvarchar](100) NULL,
	[timeloss] [nvarchar](5) NULL,
	[LUNCHEARLYDEPARTURE] [nvarchar](100) NULL,
	[LUNCHLATEARRIVAL] [int] NULL,
	[ShiftEndTime] [datetime] NULL,
	[Remark] [nvarchar](50) NULL,
	[LEAVEVALUE] [numeric](6, 2) NULL,
	[PRESENTVALUE] [numeric](6, 2) NULL,
	[ABSENTVALUE] [numeric](6, 2) NULL,
	[HOLIDAY_VALUE] [numeric](6, 2) NULL,
	[WO_VALUE] [numeric](6, 2) NULL,
	[HOURSWORKED] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[table4]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[table4](
	[rn] [bigint] NULL,
	[cardno] [nvarchar](10) NOT NULL,
	[LocationIN] [nvarchar](100) NULL,
	[LocationOut] [nvarchar](100) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[tbl_realtime_enroll_data]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_realtime_enroll_data](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[update_time] [datetime] NOT NULL,
	[device_id] [nvarchar](24) NOT NULL,
	[user_id] [nvarchar](24) NOT NULL,
	[user_data] [varbinary](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TblEnroll]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TblEnroll](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[EMachineNumber] [int] NULL,
	[EnrollNumber] [int] NULL,
	[FingerNumber] [int] NULL,
	[Privilige] [int] NULL,
	[pwd] [int] NULL,
	[FPData] [nvarchar](4000) NULL,
	[EnrollName] [nvarchar](200) NULL,
	[BranchId] [int] NULL,
	[FPData1] [image] NULL,
	[fpdata2] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[tblEnroll12]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tblEnroll12](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[EMachineNumber] [int] NULL,
	[EnrollNumber] [int] NULL,
	[FingerNumber] [int] NULL,
	[Privilige] [int] NULL,
	[pwd] [int] NULL,
	[FPData] [nvarchar](4000) NULL,
	[EnrollName] [nvarchar](200) NULL,
	[BranchId] [int] NULL,
	[FPData1] [image] NULL,
	[fpdata2] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Temp_EmpId]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Temp_EmpId](
	[EmpId] [numeric](18, 0) NOT NULL,
 CONSTRAINT [PK_Temp_EmpId] PRIMARY KEY CLUSTERED 
(
	[EmpId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[temp_enrollData]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[temp_enrollData](
	[enrollid] [nchar](20) NULL,
	[admin] [nchar](20) NULL,
	[backupnum] [nchar](20) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[temp_lunch_Dinner]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[temp_lunch_Dinner](
	[DateOffice] [nchar](10) NULL,
	[EmpId] [numeric](18, 0) NOT NULL,
	[Break1IN] [nchar](5) NULL,
	[Break2in] [nchar](5) NULL,
	[Branch_Name] [nvarchar](100) NOT NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Temp_Lunch_Report]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Temp_Lunch_Report](
	[Empid] [int] NULL,
	[PunchDateTime] [datetime] NULL,
	[InTime] [datetime] NULL,
	[OutTime] [datetime] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Temp_template]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Temp_template](
	[EmployeeName] [nvarchar](255) NULL,
	[FatherName] [nvarchar](255) NULL,
	[Paycode] [nvarchar](255) NULL,
	[CardNo] [nvarchar](255) NULL,
	[Email] [nvarchar](255) NULL,
	[Department] [nvarchar](255) NULL,
	[Designation] [nvarchar](255) NULL,
	[BranchName] [nvarchar](255) NULL,
	[OfficeTimePolicy] [nvarchar](255) NULL,
	[DateofJoin] [datetime] NULL,
	[ShiftCode] [nvarchar](255) NULL,
	[WeeklyOff] [nvarchar](255) NULL,
	[CompanyName] [nvarchar](255) NULL,
	[Phoneno] [nvarchar](50) NULL,
	[cardno1] [nvarchar](10) NULL,
	[DateofBirth] [datetime] NULL,
	[ShiftStartDate] [datetime] NULL,
	[EmailAddress] [varchar](5000) NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Tempid]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tempid](
	[Empid] [numeric](18, 0) IDENTITY(1,1) NOT NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[TempMachinePunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TempMachinePunch](
	[Tran_MachineRawPunchId] [int] NOT NULL,
	[EmpName] [nvarchar](50) NOT NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[PunchDate] [nvarchar](30) NULL,
	[PunchTime] [nvarchar](30) NULL,
	[P_Day] [nchar](1) NOT NULL,
	[Paycode] [nvarchar](10) NOT NULL,
	[MachineNo] [nvarchar](5) NULL,
	[isManual] [nchar](1) NOT NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Temprature_data]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Temprature_data](
	[id] [bigint] IDENTITY(1,1) NOT NULL,
	[Imagedata] [nvarchar](max) NULL,
	[tran_machinerawpunch] [bigint] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[TimeZone]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TimeZone](
	[Tz] [int] NULL,
	[StartTime1] [nvarchar](10) NULL,
	[EndTime1] [nvarchar](10) NULL,
	[StartTime2] [nvarchar](10) NULL,
	[EndTime2] [nvarchar](10) NULL,
	[StartTime3] [nvarchar](10) NULL,
	[EndTime3] [nvarchar](10) NULL,
	[StartTime4] [nvarchar](10) NULL,
	[EndTime4] [nvarchar](10) NULL,
	[StartTime5] [nvarchar](10) NULL,
	[EndTime5] [nvarchar](10) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Tran_Attendance]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Tran_Attendance](
	[RowId] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
	[EmpId] [int] NOT NULL,
	[PAYCODE] [nchar](10) NULL,
	[DateOFFICE] [datetime] NOT NULL,
	[SHIFTSTARTTIME] [datetime] NULL,
	[SHIFTENDTIME] [datetime] NULL,
	[LUNCHSTARTTIME] [datetime] NULL,
	[LUNCHENDTIME] [datetime] NULL,
	[HOURSWORKED] [int] NULL,
	[EXCLUNCHHOURS] [int] NULL,
	[OTDURATION] [int] NULL,
	[OSDURATION] [int] NULL,
	[OTAMOUNT] [numeric](10, 2) NULL,
	[EARLYARRIVAL] [int] NULL,
	[EARLYDEPARTURE] [int] NULL,
	[LATEARRIVAL] [int] NULL,
	[LUNCHEARLYDEPARTURE] [int] NULL,
	[LUNCHLATEARRIVAL] [int] NULL,
	[TOTALLOSSHRS] [int] NULL,
	[STATUS] [nvarchar](20) NULL,
	[LEAVETYPE1] [nchar](1) NULL,
	[LEAVETYPE2] [nchar](1) NULL,
	[FIRSTHALFLEAVECODE] [nchar](3) NULL,
	[SECONDHALFLEAVECODE] [nchar](3) NULL,
	[REASON] [nchar](30) NULL,
	[SHIFT] [nchar](3) NULL,
	[SHIFTATTENDED] [nchar](3) NULL,
	[IN1] [datetime] NULL,
	[IN2] [datetime] NULL,
	[OUT1] [datetime] NULL,
	[OUT2] [datetime] NULL,
	[IN1MANNUAL] [nchar](1) NULL,
	[IN2MANNUAL] [nchar](1) NULL,
	[OUT1MANNUAL] [nchar](1) NULL,
	[OUT2MANNUAL] [nchar](1) NULL,
	[LEAVEVALUE] [numeric](6, 2) NULL CONSTRAINT [DF_Tran_Attendance_LEAVEVALUE]  DEFAULT ((0)),
	[PRESENTVALUE] [numeric](6, 2) NULL CONSTRAINT [DF_Tran_Attendance_PRESENTVALUE]  DEFAULT ((0)),
	[ABSENTVALUE] [numeric](6, 2) NULL CONSTRAINT [DF_Tran_Attendance_ABSENTVALUE]  DEFAULT ((0)),
	[HOLIDAY_VALUE] [numeric](6, 2) NULL CONSTRAINT [DF_Tran_Attendance_HOLIDAY_VALUE]  DEFAULT ((0)),
	[WO_VALUE] [numeric](6, 2) NULL CONSTRAINT [DF_Tran_Attendance_WO_VALUE]  DEFAULT ((0)),
	[OUTWORKDURATION] [int] NULL,
	[LEAVETYPE] [nchar](1) NULL,
	[LEAVECODE] [nchar](3) NULL,
	[LEAVEAMOUNT] [numeric](6, 2) NULL CONSTRAINT [DF_Tran_Attendance_LEAVEAMOUNT]  DEFAULT ((0)),
	[LEAVEAMOUNT1] [numeric](6, 2) NULL CONSTRAINT [DF_Tran_Attendance_LEAVEAMOUNT1]  DEFAULT ((0)),
	[LEAVEAMOUNT2] [numeric](6, 2) NULL CONSTRAINT [DF_Tran_Attendance_LEAVEAMOUNT2]  DEFAULT ((0)),
	[FLAG] [nchar](4) NULL,
	[LEAVEAPRDate] [datetime] NULL,
	[VOUCHER_NO] [nchar](10) NULL,
	[ReasonCode] [nchar](3) NULL,
	[OTHalfProcess] [nvarchar](1) NULL,
	[MOtDuration] [int] NULL,
	[LateDeduction] [numeric](11, 2) NULL,
	[EarlyDeduction] [numeric](11, 2) NULL,
	[mOTAddition] [numeric](11, 2) NULL,
	[mGatePass] [numeric](11, 2) NULL,
	[mGatePass_Type] [nchar](1) NULL,
	[Remark] [nvarchar](50) NULL,
	[Sms_Status] [bit] NULL CONSTRAINT [DF_Tran_Attendance_Sms_Status]  DEFAULT ((0)),
	[Punch1] [datetime] NULL,
	[Punch2] [datetime] NULL,
	[Punch3] [datetime] NULL,
	[Punch4] [datetime] NULL,
	[sms1] [int] NOT NULL DEFAULT ((0)),
	[sms2] [int] NOT NULL DEFAULT ((0)),
	[sms3] [int] NOT NULL DEFAULT ((0)),
	[Punch5] [datetime] NULL,
	[Punch6] [datetime] NULL,
	[Punch7] [datetime] NULL,
	[Punch8] [datetime] NULL,
	[Punch9] [datetime] NULL,
	[Punch10] [datetime] NULL,
	[Punch11] [datetime] NULL,
	[Punch12] [datetime] NULL,
	[Punch13] [datetime] NULL,
	[Punch14] [datetime] NULL,
	[Punch15] [datetime] NULL,
	[Punch16] [datetime] NULL,
	[Punch17] [datetime] NULL,
	[Punch18] [datetime] NULL,
	[senddata] [int] NULL,
	[CoreDays] [nvarchar](50) NULL,
	[CoreDayCount] [int] NULL,
	[Break1Shiftin] [datetime] NULL,
	[Break1Shiftout] [datetime] NULL,
	[Break2Shiftin] [datetime] NULL,
	[Break2Shiftout] [datetime] NULL,
	[Break1in] [datetime] NULL,
	[Break1Out] [datetime] NULL,
	[Break2in] [datetime] NULL,
	[Break2Out] [datetime] NULL,
	[ShiftType] [varchar](50) NULL,
	[Sms2Text] [varchar](5000) NULL,
	[latesms1] [int] NOT NULL DEFAULT ((0)),
	[Sms1Text] [varchar](5000) NULL,
	[latesmstext] [varchar](5000) NULL,
	[Sms3Text] [varchar](5000) NULL,
	[allpunchs] [nvarchar](500) NULL,
	[in_temp] [varchar](10) NULL,
	[Out_temp] [varchar](10) NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Tran_Daily_Attendance_Temp]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tran_Daily_Attendance_Temp](
	[CardNo] [nvarchar](10) NOT NULL,
	[PunchDatetime] [datetime] NOT NULL,
	[Process] [nchar](1) NULL,
	[MachineNo] [nvarchar](5) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Tran_MachineRawPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tran_MachineRawPunch](
	[Tran_MachineRawPunchId] [int] IDENTITY(1,1) NOT NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[PunchDatetime] [datetime] NULL,
	[P_Day] [nchar](1) NOT NULL CONSTRAINT [DF_Tran_MachineRawPunch_P_Day]  DEFAULT ('N'),
	[ISManual] [nchar](1) NOT NULL,
	[PayCode] [nvarchar](50) NULL,
	[MachineNo] [nvarchar](5) NULL CONSTRAINT [DF__Tran_Mach__Machi__3552E9B6]  DEFAULT ('1'),
	[Dateime1] [datetime] NOT NULL DEFAULT (getdate()),
	[id] [nvarchar](10) NULL,
	[empid] [nvarchar](10) NULL,
	[inout] [nvarchar](10) NULL,
	[senddata] [nvarchar](50) NULL,
	[OutPunch] [datetime] NULL,
	[Checkin] [datetime] NULL,
	[Checkout] [datetime] NULL,
	[CheckinOut] [nvarchar](50) NULL,
	[viewinfo] [int] NULL DEFAULT ((0)),
	[showData] [int] NOT NULL DEFAULT ((0)),
	[Remark] [nvarchar](100) NULL,
	[DeviceIp_SRNo] [nvarchar](80) NULL,
	[V_name] [nvarchar](255) NULL,
	[v_Address] [nvarchar](300) NULL,
	[V_Phoneno] [nvarchar](50) NULL,
	[temp] [nvarchar](30) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Tran_MachineSetup]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tran_MachineSetup](
	[MCSetupId] [int] IDENTITY(1,1) NOT NULL,
	[McTypeId] [int] NOT NULL,
	[TypeName] [nvarchar](50) NOT NULL,
	[PortNo] [int] NOT NULL,
	[MCNo] [int] NOT NULL,
	[IPAddress] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_Tran_MachineSetup] PRIMARY KEY CLUSTERED 
(
	[MCSetupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Tran_ManualPunch_loc]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Tran_ManualPunch_loc](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Cardno] [nvarchar](8) NULL,
	[PunchDatetime] [datetime] NULL,
	[location] [nvarchar](500) NULL,
	[lan] [nvarchar](80) NULL,
	[long] [nvarchar](80) NULL,
	[ImageData] [image] NULL,
	[ImeiNo] [nvarchar](20) NULL,
	[temp1] [nvarchar](50) NULL,
	[temp2] [nvarchar](50) NULL,
	[AttendanceType] [int] NULL,
	[Remark1] [varchar](500) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Tran_ManualPunch_loc1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tran_ManualPunch_loc1](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Cardno] [nvarchar](8) NULL,
	[PunchDatetime] [datetime] NULL,
	[location] [nvarchar](500) NULL,
	[lan] [nvarchar](80) NULL,
	[long] [nvarchar](80) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Tran_ManualPunch_loc12]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tran_ManualPunch_loc12](
	[ID] [bigint] IDENTITY(1,1) NOT NULL,
	[Cardno] [nvarchar](8) NULL,
	[PunchDatetime] [datetime] NULL,
	[location] [nvarchar](500) NULL,
	[lan] [nvarchar](80) NULL,
	[long] [nvarchar](80) NULL,
	[ImageData] [image] NULL,
	[ImeiNo] [nvarchar](20) NULL,
	[temp1] [nvarchar](50) NULL,
	[temp2] [nvarchar](50) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Tran_PaidSalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tran_PaidSalaryDetail](
	[EmpId] [numeric](18, 0) NOT NULL,
	[MonthNo] [int] NOT NULL,
	[YearNo] [int] NOT NULL,
	[MonthDay] [int] NOT NULL,
	[Present] [numeric](5, 2) NOT NULL,
	[Absent] [numeric](5, 2) NOT NULL,
	[WeeklyOff] [numeric](5, 2) NOT NULL,
	[Holidays] [numeric](5, 2) NOT NULL,
	[PaidLeave] [numeric](5, 2) NOT NULL,
	[PayDays] [numeric](5, 2) NOT NULL,
	[Addtion1_Rate] [numeric](12, 2) NOT NULL,
	[Addition2_Rate] [numeric](12, 2) NOT NULL,
	[Addition3_Rate] [numeric](12, 2) NOT NULL,
	[Addition4_Rate] [numeric](12, 0) NOT NULL,
	[Addition5_Rate] [numeric](12, 2) NOT NULL,
	[Addition6_Rate] [numeric](12, 2) NOT NULL,
	[Addition7_Rate] [numeric](12, 2) NOT NULL,
	[Addition8_Rate] [numeric](12, 2) NOT NULL,
	[Addition9_Rate] [numeric](12, 2) NOT NULL,
	[Addition10_Rate] [numeric](12, 2) NOT NULL,
	[Addition1_Paid] [numeric](12, 2) NOT NULL,
	[Addition2_Paid] [numeric](12, 2) NOT NULL,
	[Addition3_Paid] [numeric](12, 2) NOT NULL,
	[Addition4_Paid] [numeric](12, 2) NOT NULL,
	[Addition5_Paid] [numeric](12, 2) NOT NULL,
	[Addition6_Paid] [numeric](12, 2) NOT NULL,
	[Addition7_Paid] [numeric](12, 2) NOT NULL,
	[Addition8_Paid] [numeric](12, 2) NOT NULL,
	[Addition9_Paid] [numeric](12, 2) NOT NULL,
	[Addition10_Paid] [numeric](12, 2) NOT NULL,
	[Ded1_Rate] [numeric](12, 2) NOT NULL,
	[Ded2_Rate] [numeric](12, 2) NOT NULL,
	[Ded3_Rate] [numeric](12, 2) NOT NULL,
	[Ded4_Rate] [numeric](12, 2) NOT NULL,
	[Ded5_Rate] [numeric](12, 2) NOT NULL,
	[Ded1_Ded] [numeric](12, 2) NOT NULL,
	[Ded2_Ded] [numeric](12, 2) NOT NULL,
	[Ded3_Ded] [numeric](12, 0) NOT NULL,
	[Ded4_Ded] [numeric](12, 0) NOT NULL,
	[Ded5_Ded] [numeric](12, 0) NOT NULL,
	[FDed1] [numeric](12, 0) NOT NULL,
	[FDed2] [numeric](12, 0) NOT NULL,
	[FDed3] [numeric](12, 0) NOT NULL,
	[FDed4] [numeric](12, 0) NOT NULL,
	[FDed5] [numeric](12, 0) NOT NULL,
	[PF_Ded] [numeric](12, 2) NOT NULL,
	[EPF_Ded] [numeric](12, 2) NOT NULL,
	[PPF_Ded] [numeric](12, 2) NOT NULL,
	[ESI_Ded] [numeric](12, 2) NOT NULL,
	[OTHours] [nvarchar](50) NOT NULL,
	[TdsAmountVal] [numeric](12, 2) NOT NULL,
	[TdsRate] [numeric](12, 2) NOT NULL,
	[TDsAmt] [numeric](12, 2) NOT NULL,
	[OTRate] [numeric](10, 2) NOT NULL,
	[OTAmount] [numeric](12, 2) NOT NULL,
	[Tota_Earning] [numeric](12, 2) NOT NULL,
	[Total_Ded] [numeric](12, 2) NOT NULL,
	[NetPay] [numeric](12, 2) NOT NULL,
	[Amtinword] [nvarchar](1000) NULL,
	[LoanID] [numeric](12, 2) NULL,
	[Loanname] [nvarchar](250) NULL,
	[subdays] [int] NULL,
 CONSTRAINT [PK_Tran_PaidSalaryDetail] PRIMARY KEY CLUSTERED 
(
	[EmpId] ASC,
	[MonthNo] ASC,
	[YearNo] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Tran_TeaLunchBreaks]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Tran_TeaLunchBreaks](
	[RowId] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
	[EmpId] [numeric](18, 0) NOT NULL,
	[DateOffice] [smalldatetime] NOT NULL,
	[Tea1Out] [smalldatetime] NULL,
	[Tea1In] [smalldatetime] NULL,
	[Tea1Min] [int] NULL,
	[Tea2Out] [smalldatetime] NULL,
	[Tea2In] [smalldatetime] NULL,
	[Tea2Min] [int] NULL,
	[LunchOut] [smalldatetime] NULL,
	[LunchIn] [smalldatetime] NULL,
	[LunchMin] [int] NULL,
	[OD1Out] [smalldatetime] NULL,
	[OD1In] [smalldatetime] NULL,
	[OD1Min] [int] NULL,
 CONSTRAINT [PK_Tran_TeaLunchBreaks] PRIMARY KEY CLUSTERED 
(
	[EmpId] ASC,
	[DateOffice] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Visitorinfo]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Visitorinfo](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[NumberofPersons] [nvarchar](10) NULL,
	[VisitorName] [nvarchar](255) NULL,
	[Deptid] [int] NULL,
	[Desigid] [int] NULL,
	[Emailaddress] [nvarchar](255) NULL,
	[ContactNumber] [nvarchar](255) NULL,
	[Address] [nvarchar](255) NULL,
	[ToMeet] [nvarchar](255) NULL,
	[Dateandtime] [datetime] NULL,
	[FloorNo] [nvarchar](50) NULL,
	[PreparedBy] [nvarchar](150) NULL,
	[VisitorCompany] [nvarchar](255) NULL,
	[Accessories] [nvarchar](255) NULL,
	[Status] [nvarchar](255) NULL,
	[SecurityLevel] [nvarchar](255) NULL,
	[IdProofCategory] [nvarchar](255) NULL,
	[IdProof] [nvarchar](255) NULL,
	[InTime] [datetime] NULL,
	[Outtime] [datetime] NULL,
	[NumberofIssueCard] [nvarchar](20) NULL,
	[carddvalidity] [nvarchar](20) NULL,
	[imagepath] [nvarchar](500) NULL,
	[ToMeetid] [int] NULL,
	[visitper] [nvarchar](500) NULL,
	[Remark] [nvarchar](255) NULL,
	[Dept_Names] [nvarchar](255) NULL,
	[Desig_Names] [nvarchar](255) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[WeekDayName]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WeekDayName](
	[DayId] [numeric](2, 0) NOT NULL,
	[DayName] [nvarchar](20) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[weekdayNames]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[weekdayNames](
	[DayId] [numeric](2, 0) IDENTITY(1,1) NOT NULL,
	[DayName] [nvarchar](20) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[weekdays]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[weekdays](
	[WeekNo] [smallint] IDENTITY(1,1) NOT NULL,
	[WeekName] [nvarchar](20) NOT NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[WeekTimeZone]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[WeekTimeZone](
	[Tz] [int] NULL,
	[sun] [int] NULL,
	[mon] [int] NULL,
	[tue] [int] NULL,
	[wed] [int] NULL,
	[thu] [int] NULL,
	[fri] [int] NULL,
	[sat] [int] NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[yearlyAbsent]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[yearlyAbsent](
	[month] [nvarchar](30) NULL,
	[TotalAbsent] [int] NULL,
	[Empid] [int] NOT NULL,
	[EmpName] [nvarchar](50) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[yearlyPersent]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[yearlyPersent](
	[month] [nvarchar](30) NULL,
	[TotalPresent] [int] NULL,
	[Empid] [int] NOT NULL,
	[EmpName] [nvarchar](50) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[yogiaa]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[yogiaa](
	[Tran_MachineRawPunchId] [int] IDENTITY(1,1) NOT NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[PunchDatetime] [smalldatetime] NOT NULL,
	[P_Day] [nchar](1) NOT NULL,
	[ISManual] [nchar](1) NOT NULL,
	[PayCode] [nvarchar](50) NULL,
	[MachineNo] [nvarchar](5) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[yogiaab]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[yogiaab](
	[Tran_MachineRawPunchId] [int] IDENTITY(1,1) NOT NULL,
	[CardNo] [nvarchar](10) NOT NULL,
	[PunchDatetime] [smalldatetime] NOT NULL,
	[P_Day] [nchar](1) NOT NULL,
	[ISManual] [nchar](1) NOT NULL,
	[PayCode] [nvarchar](50) NULL,
	[MachineNo] [nvarchar](5) NULL
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[yyyttt]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[yyyttt](
	[CardNo] [nvarchar](10) NOT NULL,
	[PunchDatetime] [smalldatetime] NOT NULL,
	[P_Day] [nchar](1) NOT NULL,
	[PayCode] [nvarchar](50) NULL,
	[MachineNo] [nvarchar](5) NULL
) ON [PRIMARY]

GO
/****** Object:  UserDefinedFunction [dbo].[udf_earlyUpdate]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE function [dbo].[udf_earlyUpdate](@ID int,@dt datetime) RETURNS TABLE

AS

RETURN SELECT TOP 2 Amount FROM Log WHERE UniqueID = @ID and date<@dt ORDER BY date DESC


GO
SET IDENTITY_INSERT [dbo].[Mst_Branch] ON 

INSERT [dbo].[Mst_Branch] ([BranchId], [Branch_Name], [Address], [PhoneNo], [EmailId], [Active], [On_Date], [By_User], [CompanyId]) VALUES (1, N'DEMO', N'DEMO', N'', N'', 1, CAST(N'2018-03-29 06:42:00' AS SmallDateTime), 1, 1)
SET IDENTITY_INSERT [dbo].[Mst_Branch] OFF
SET IDENTITY_INSERT [dbo].[Mst_Company] ON 

INSERT [dbo].[Mst_Company] ([CompanyId], [CompanyName], [Description], [Address], [PhoneNo], [EmailId], [Vat_No], [Pf_No], [Tan_No], [Reg_No], [Esi_No], [Pan_No], [PF], [FPF], [PPF], [ESI], [Addition1], [Addition2], [Addition3], [Addition4], [Addition5], [Addition6], [Addition7], [Addition8], [Addition9], [Addition10], [Ded1], [Ded2], [Ded3], [Ded4], [Ded5], [FDed1], [FDed2], [FDed3], [FDed4], [FDed5], [Active], [On_Date], [By_User]) VALUES (1, N'DEMO', N'', N'DEMO', N'', N'', N'', N'', N'', N'', N'', N'', CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(18, 2)), CAST(0.00 AS Numeric(6, 2)), N'Basic', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'', N'Loan/Advance', 1, CAST(N'2018-03-29 06:41:00' AS SmallDateTime), NULL)
SET IDENTITY_INSERT [dbo].[Mst_Company] OFF
SET IDENTITY_INSERT [dbo].[Mst_CorpPolicy] ON 

INSERT [dbo].[Mst_CorpPolicy] ([DuplidatePunchMin], [MaxEarlyComming], [MaxLateGoing], [MinPresentForWO], [AWAasAAA], [OTFormula], [WorkHRCalc], [ShowPayroll], [absentonsinglePunch], [SalCalMode], [CorpPolicyid], [PolicyName]) VALUES (CAST(0.02 AS Numeric(6, 2)), CAST(2.00 AS Numeric(6, 2)), CAST(6.00 AS Numeric(6, 2)), CAST(4.00 AS Numeric(6, 2)), 0, 1, 1, 0, N'0', 0, 1, N'Gen')
SET IDENTITY_INSERT [dbo].[Mst_CorpPolicy] OFF
SET IDENTITY_INSERT [dbo].[Mst_Department] ON 

INSERT [dbo].[Mst_Department] ([DeptId], [Dept_Name], [Dept_Description], [Active], [On_Date], [By_User]) VALUES (1, N'DEMO', N'', 1, CAST(N'2018-03-29 06:42:00' AS SmallDateTime), 1)
SET IDENTITY_INSERT [dbo].[Mst_Department] OFF
SET IDENTITY_INSERT [dbo].[Mst_Designation] ON 

INSERT [dbo].[Mst_Designation] ([DesigId], [Desig_Name], [Desig_Description], [Active], [On_Date], [By_User]) VALUES (1, N'DEMO', N'', 1, CAST(N'2018-03-29 06:42:00' AS SmallDateTime), 1)
SET IDENTITY_INSERT [dbo].[Mst_Designation] OFF
SET IDENTITY_INSERT [dbo].[Mst_Employee] ON 

INSERT [dbo].[Mst_Employee] ([EmpId], [EmpName], [FatherName], [EmpCode], [pwd], [CardNo], [CompanyId], [DeptId], [DesigId], [BranchId], [OTimePoliceId], [DateofJoin], [ReginDate], [SuperiourName], [ShiftId], [ShiftType], [ShiftPatternId], [IsAutoShift], [Auto_Shifts], [FirstOffDay], [SecondOffDayType], [SecondOffDay], [HalfDayShiftId], [SecondWeekOffDays], [ShiftRemaindays], [CDays], [ShiftStartDate], [ShiftCode], [HalfDayShiftCode], [ImagePath], [active], [On_Date], [By_User], [EmailAddress], [BSalary], [LeaveActive], [LaveBalance], [PhoneNo], [ProfilePic], [CorpPolicyid], [DateofBirth], [GPSActive], [cardno1], [Validitystart], [Validityend], [WeekTimeZone], [WeekTimeZone2], [WeekTimeZone3], [WeekTimeZone4], [EAddress], [DeviceToken], [type], [adminnotification], [empDeviceToken], [AdminDeviceToken], [TourAmt]) VALUES (CAST(2 AS Numeric(18, 0)), N'DEMO', N'', N'1', N'1', N'00000001', 1, 1, 1, 1, 2, CAST(N'2019-01-01 00:00:00' AS SmallDateTime), N'', 1, 2, N'Fixed', N'', 0, N'', N'Sunday         ', N'None', N'None           ', 0, N'', 0, 7, CAST(N'2019-01-01 00:00:00' AS SmallDateTime), N'GEN', N'Non', N'', 1, CAST(N'2019-03-26 16:12:00' AS SmallDateTime), 1, N'', N'0', NULL, NULL, N'8743874334', NULL, 1, CAST(N'2012-01-01 00:00:00.000' AS DateTime), 0, N'', NULL, NULL, NULL, NULL, NULL, NULL, N'', NULL, NULL, 1, NULL, NULL, N'0')
SET IDENTITY_INSERT [dbo].[Mst_Employee] OFF
SET IDENTITY_INSERT [dbo].[Mst_EmpOfficeTime] ON 

INSERT [dbo].[Mst_EmpOfficeTime] ([OTimePoliceId], [OfficeTimePolicyName], [LateHour], [EarlyHour], [DayMaxworkHour], [PresentDuration], [HalfDayWorkHour], [HalfDayAbsentHour], [RoundClock], [TimeLoss], [HalfDay], [ShortLeave], [OverStay], [OverTime], [OTRate], [RequiredPunch], [SinglePunchValue], [On_Date], [By_User], [LateSettingEnable], [NoOfLateInAMonth], [MarkifLate], [LateTime], [EnableShowLunchAsOt], [ShowLunchAsOtTime], [LateArrival], [Showforlate], [EarlyDept], [Showforealry], [AttendanceType], [chkhrsinday], [hrsforday], [hrsinday], [Maxotintmonth], [maxotsetting], [IgnoreOTSetting], [cl]) VALUES (2, N'GEN', CAST(0.10 AS Numeric(6, 2)), CAST(0.10 AS Numeric(6, 2)), CAST(8.00 AS Numeric(6, 2)), CAST(4.00 AS Numeric(6, 2)), CAST(3.59 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), 0, 1, 1, 1, 1, 1, CAST(0.00 AS Numeric(8, 2)), 5, CAST(2 AS Numeric(8, 0)), CAST(N'2019-03-26 16:11:00' AS SmallDateTime), 1, 0, 0, N'P/2', N'CutDays', 0, N'00:00', N'00:00', 0, N'00:00', 0, 1, 0, N'00:00', 0, N'00:00', 0, N'', NULL)
SET IDENTITY_INSERT [dbo].[Mst_EmpOfficeTime] OFF
SET IDENTITY_INSERT [dbo].[mst_machineType1] ON 

INSERT [dbo].[mst_machineType1] ([MachineId], [MachineNo], [MachineType], [MachineIp], [Port], [pwd], [BranchId], [UserId], [IsDyndns], [TimeZone1], [In_out]) VALUES (1, N'2', N'T52', N'RSS110092', N'7788', N'', 1, 1, N'', N'Default value', N'In')
SET IDENTITY_INSERT [dbo].[mst_machineType1] OFF
SET IDENTITY_INSERT [dbo].[Mst_Shift] ON 

INSERT [dbo].[Mst_Shift] ([ShiftId], [ShiftCode], [ShiftName], [StartTime], [EndTime], [ShiftDuration], [Break1Begun], [Break1End], [Break1Duration], [Break2Begun], [Break2End], [Break2Duration], [LunchBegun], [LunchEnd], [LunchDur], [Active], [On_Date], [By_User], [Break3Begun], [Break3End], [Break3Duration], [Break4Begun], [Break4End], [Break4Duration], [Break5Begun], [Break5End], [Break5Duration], [Break6Begun], [Break6End], [Break6Duration], [Break7Begun], [Break7End], [Break7Duration], [Break8Begun], [Break8End], [Break8Duration], [Break9Begun], [Break9End], [Break9Duration], [Break10Begun], [Break10End], [Break10Duration], [Break11Begun], [Break11End], [Break11Duration], [Break12Begun], [Break12End], [Break12Duration], [FirstOffDay], [SecondOffDaytype], [SecondOffDay], [HalfDayShiftID], [SecondWeekOffDays], [DuplidatePunchMin], [MaxEarlyComming], [MaxLateGoing], [MinPresentForWO], [AWAasAAA], [OTFormula], [WorkHRCalc], [ShowPayroll], [absentonsinglePunch], [SalCalMode], [shifttype], [Awaaslal], [twoshiftinaday]) VALUES (2, N'GEN', N'GEN', CAST(10.00 AS Numeric(6, 2)), CAST(18.00 AS Numeric(6, 2)), CAST(8.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, 1, CAST(N'2019-03-26 16:12:00' AS SmallDateTime), 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'Sunday', N'None', N'None', N'0', N'0,0,0,0,0,', CAST(0.01 AS Numeric(6, 2)), CAST(2.00 AS Numeric(6, 2)), CAST(4.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), 0, 2, 2, 1, N'0', 0, 0, 0, 0)
SET IDENTITY_INSERT [dbo].[Mst_Shift] OFF
SET IDENTITY_INSERT [dbo].[Mst_User] ON 

INSERT [dbo].[Mst_User] ([User_Id], [User_Login_Id], [User_Name], [User_Password], [Parent_User_Id], [User_Enabled], [email], [Mobile], [On_Date], [Per], [Branch_per], [Company_per], [Dept_per], [AllowAccess], [leaveaccess], [visitor_per], [DeviceToken], [type], [adminnotification]) VALUES (1, N'admin', N'admin', N'admin', 1, 1, N'', N'', CAST(N'2021-03-19 00:00:00' AS SmallDateTime), N'1,5,9,2,10,3,7,4,8,26,28,29,30,31,32,33,332,100,101,102,103,41,42,43,44,34,35,36,334,37,333,51,52,53,54,', N'1', N'1', N'1', N'1', N'1', 1, NULL, NULL, 1)
SET IDENTITY_INSERT [dbo].[Mst_User] OFF
SET IDENTITY_INSERT [dbo].[Notification] ON 

INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (1, N'Sharad Baliyan Out At : 2019-03-26 13:58', 0, CAST(N'2019-03-26 13:58:00.000' AS DateTime), N'00000001')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (2, N'ABC Out At : 2019-03-26 13:58', 0, CAST(N'2019-03-26 13:58:00.000' AS DateTime), N'00000002')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (3, N'DEF Out At : 2019-03-26 13:58', 0, CAST(N'2019-03-26 13:58:00.000' AS DateTime), N'00000003')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (4, N'Sharad Baliyan Out At : 2019-03-27 11:24', 0, CAST(N'2019-03-27 11:24:00.000' AS DateTime), N'00000001')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (5, N'Sharad Baliyan Out At : 2019-03-27 11:26', 0, CAST(N'2019-03-27 11:26:00.000' AS DateTime), N'00000001')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (6, N'Sharad Baliyan Out At : 2019-03-27 11:30', 0, CAST(N'2019-03-27 11:30:00.000' AS DateTime), N'00000001')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (7, N'Sharad Baliyan Out At : 2019-03-27 11:31', 0, CAST(N'2019-03-27 11:31:00.000' AS DateTime), N'00000001')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (8, N'Sharad Baliyan Out At : 2019-03-27 11:57', 0, CAST(N'2019-03-27 11:57:00.000' AS DateTime), N'00000001')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (9, N'Sharad Baliyan Out At : 2019-03-27 12:02', 0, CAST(N'2019-03-27 12:02:00.000' AS DateTime), N'00000001')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (10, N'Sharad Baliyan Out At : 2019-03-27 12:09', 0, CAST(N'2019-03-27 12:09:00.000' AS DateTime), N'00000001')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (11, N'ABC Out At : 2019-03-27 12:17', 0, CAST(N'2019-03-27 12:17:00.000' AS DateTime), N'00000002')
INSERT [dbo].[Notification] ([Id], [Msg], [Status], [Punchdatetime], [cardno]) VALUES (12, N'Sharad Baliyan Out At : 2019-03-27 12:17', 0, CAST(N'2019-03-27 12:17:00.000' AS DateTime), N'00000001')
SET IDENTITY_INSERT [dbo].[Notification] OFF
INSERT [dbo].[SMS_API] ([S_API], [SenderID], [Uname], [pwd], [Active], [inSms], [OutSms], [AbsentSms], [instat], [OutStat], [AbsentStat], [andriod_notification], [andriodstate], [LateStat], [Latesms], [chtemp], [Smtp_Name], [Smtp_port], [Smtp_Email], [smtp_pwd]) VALUES (N'#', N'', N'', N'', 3, N'Name# in At : Date#   Time#', N'Name# in Out : Date#  Time#', N'', 1, 1, 0, NULL, 0, 0, N'', N'0', N'', N'', N'', N'')
INSERT [dbo].[Temp_EmpId] ([EmpId]) VALUES (CAST(2 AS Numeric(18, 0)))
INSERT [dbo].[Temp_template] ([EmployeeName], [FatherName], [Paycode], [CardNo], [Email], [Department], [Designation], [BranchName], [OfficeTimePolicy], [DateofJoin], [ShiftCode], [WeeklyOff], [CompanyName], [Phoneno], [cardno1], [DateofBirth], [ShiftStartDate], [EmailAddress]) VALUES (N'Sharad Baliyan', N'', N'1', N'00000001', NULL, N'Class 1', N'Section A', N'Demo', N'GEN', CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'GEN', N'Sunday', N'Demo', N'', N'', CAST(N'2012-01-01 00:00:00.000' AS DateTime), CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'')
INSERT [dbo].[Temp_template] ([EmployeeName], [FatherName], [Paycode], [CardNo], [Email], [Department], [Designation], [BranchName], [OfficeTimePolicy], [DateofJoin], [ShiftCode], [WeeklyOff], [CompanyName], [Phoneno], [cardno1], [DateofBirth], [ShiftStartDate], [EmailAddress]) VALUES (N'ABC', N'', N'2', N'00000002', NULL, N'Class 1', N'Section A', N'Demo', N'GEN', CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'GEN', N'Sunday', N'Demo', N'', N'', CAST(N'2012-01-01 00:00:00.000' AS DateTime), CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'')
INSERT [dbo].[Temp_template] ([EmployeeName], [FatherName], [Paycode], [CardNo], [Email], [Department], [Designation], [BranchName], [OfficeTimePolicy], [DateofJoin], [ShiftCode], [WeeklyOff], [CompanyName], [Phoneno], [cardno1], [DateofBirth], [ShiftStartDate], [EmailAddress]) VALUES (N'DEF', N'', N'3', N'00000003', NULL, N'Class 1', N'Section A', N'Demo', N'GEN', CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'GEN', N'Sunday', N'Demo', N'', N'', CAST(N'2012-01-01 00:00:00.000' AS DateTime), CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'')
INSERT [dbo].[Temp_template] ([EmployeeName], [FatherName], [Paycode], [CardNo], [Email], [Department], [Designation], [BranchName], [OfficeTimePolicy], [DateofJoin], [ShiftCode], [WeeklyOff], [CompanyName], [Phoneno], [cardno1], [DateofBirth], [ShiftStartDate], [EmailAddress]) VALUES (N'GHI', N'', N'4', N'00000004', NULL, N'Class 1', N'Section A', N'Demo', N'GEN', CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'GEN', N'Sunday', N'Demo', N'', N'', CAST(N'2012-01-01 00:00:00.000' AS DateTime), CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'')
INSERT [dbo].[Temp_template] ([EmployeeName], [FatherName], [Paycode], [CardNo], [Email], [Department], [Designation], [BranchName], [OfficeTimePolicy], [DateofJoin], [ShiftCode], [WeeklyOff], [CompanyName], [Phoneno], [cardno1], [DateofBirth], [ShiftStartDate], [EmailAddress]) VALUES (N'JKL', N'', N'5', N'00000005', NULL, N'Class 1', N'Section A', N'Demo', N'GEN', CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'GEN', N'Sunday', N'Demo', N'', N'', CAST(N'2012-01-01 00:00:00.000' AS DateTime), CAST(N'2019-01-01 00:00:00.000' AS DateTime), N'')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
INSERT [dbo].[TimeZone] ([Tz], [StartTime1], [EndTime1], [StartTime2], [EndTime2], [StartTime3], [EndTime3], [StartTime4], [EndTime4], [StartTime5], [EndTime5]) VALUES (1, N'10:00', N'14:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00', N'00:00')
SET IDENTITY_INSERT [dbo].[Tran_Attendance] ON 

INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(1 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-01 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(2 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-02 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(3 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-03 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(4 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-04 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(5 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-05 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(6 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-06 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(7 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-07 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'WO', NULL, NULL, NULL, NULL, NULL, N'OFF', N'OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(8 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-08 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(9 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-09 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(10 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-10 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(11 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-11 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(12 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-12 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(13 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-13 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(14 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-14 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'WO', NULL, NULL, NULL, NULL, NULL, N'OFF', N'OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(15 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-15 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(16 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-16 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(17 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-17 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(18 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-18 00:00:00.000' AS DateTime), CAST(N'2021-03-18 10:00:00.000' AS DateTime), CAST(N'2021-03-18 18:00:00.000' AS DateTime), CAST(N'2021-03-18 00:00:00.000' AS DateTime), CAST(N'2021-03-18 00:00:00.000' AS DateTime), 470, 0, 0, 0, CAST(0.00 AS Numeric(10, 2)), 0, 0, 0, 0, 0, 0, N'P', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', CAST(N'2021-03-18 10:10:00.000' AS DateTime), NULL, NULL, CAST(N'2021-03-18 18:00:00.000' AS DateTime), N'N', N'N', N'N', N'N', CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), 0, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'', 0, CAST(N'1900-01-01 10:10:00.000' AS DateTime), CAST(N'1900-01-01 18:00:00.000' AS DateTime), NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, N'', N'')
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(19 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-19 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(20 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-20 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(21 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-21 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'WO', NULL, NULL, NULL, NULL, NULL, N'OFF', N'OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(22 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-22 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(23 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-23 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(24 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-24 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(25 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-25 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(26 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-26 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(27 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-27 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(28 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-28 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'WO', NULL, NULL, NULL, NULL, NULL, N'OFF', N'OFF', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(29 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-29 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(30 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-30 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_Attendance] ([RowId], [EmpId], [PAYCODE], [DateOFFICE], [SHIFTSTARTTIME], [SHIFTENDTIME], [LUNCHSTARTTIME], [LUNCHENDTIME], [HOURSWORKED], [EXCLUNCHHOURS], [OTDURATION], [OSDURATION], [OTAMOUNT], [EARLYARRIVAL], [EARLYDEPARTURE], [LATEARRIVAL], [LUNCHEARLYDEPARTURE], [LUNCHLATEARRIVAL], [TOTALLOSSHRS], [STATUS], [LEAVETYPE1], [LEAVETYPE2], [FIRSTHALFLEAVECODE], [SECONDHALFLEAVECODE], [REASON], [SHIFT], [SHIFTATTENDED], [IN1], [IN2], [OUT1], [OUT2], [IN1MANNUAL], [IN2MANNUAL], [OUT1MANNUAL], [OUT2MANNUAL], [LEAVEVALUE], [PRESENTVALUE], [ABSENTVALUE], [HOLIDAY_VALUE], [WO_VALUE], [OUTWORKDURATION], [LEAVETYPE], [LEAVECODE], [LEAVEAMOUNT], [LEAVEAMOUNT1], [LEAVEAMOUNT2], [FLAG], [LEAVEAPRDate], [VOUCHER_NO], [ReasonCode], [OTHalfProcess], [MOtDuration], [LateDeduction], [EarlyDeduction], [mOTAddition], [mGatePass], [mGatePass_Type], [Remark], [Sms_Status], [Punch1], [Punch2], [Punch3], [Punch4], [sms1], [sms2], [sms3], [Punch5], [Punch6], [Punch7], [Punch8], [Punch9], [Punch10], [Punch11], [Punch12], [Punch13], [Punch14], [Punch15], [Punch16], [Punch17], [Punch18], [senddata], [CoreDays], [CoreDayCount], [Break1Shiftin], [Break1Shiftout], [Break2Shiftin], [Break2Shiftout], [Break1in], [Break1Out], [Break2in], [Break2Out], [ShiftType], [Sms2Text], [latesms1], [Sms1Text], [latesmstext], [Sms3Text], [allpunchs], [in_temp], [Out_temp]) VALUES (CAST(31 AS Numeric(18, 0)), 2, NULL, CAST(N'2021-03-31 00:00:00.000' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, N'A', NULL, NULL, NULL, NULL, NULL, N'GEN', N'GEN', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(1.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), CAST(0.00 AS Numeric(6, 2)), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL)
SET IDENTITY_INSERT [dbo].[Tran_Attendance] OFF
SET IDENTITY_INSERT [dbo].[Tran_MachineRawPunch] ON 

INSERT [dbo].[Tran_MachineRawPunch] ([Tran_MachineRawPunchId], [CardNo], [PunchDatetime], [P_Day], [ISManual], [PayCode], [MachineNo], [Dateime1], [id], [empid], [inout], [senddata], [OutPunch], [Checkin], [Checkout], [CheckinOut], [viewinfo], [showData], [Remark], [DeviceIp_SRNo], [V_name], [v_Address], [V_Phoneno], [temp]) VALUES (1, N'00000001', CAST(N'2021-03-18 10:10:00.000' AS DateTime), N'N', N'Y', N'1', N'1', CAST(N'2021-03-18 18:44:55.787' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, N'', NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Tran_MachineRawPunch] ([Tran_MachineRawPunchId], [CardNo], [PunchDatetime], [P_Day], [ISManual], [PayCode], [MachineNo], [Dateime1], [id], [empid], [inout], [senddata], [OutPunch], [Checkin], [Checkout], [CheckinOut], [viewinfo], [showData], [Remark], [DeviceIp_SRNo], [V_name], [v_Address], [V_Phoneno], [temp]) VALUES (2, N'00000001', CAST(N'2021-03-18 18:00:00.000' AS DateTime), N'N', N'Y', N'1', N'1', CAST(N'2021-03-18 18:44:55.810' AS DateTime), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, N'', NULL, NULL, NULL, NULL, NULL)
SET IDENTITY_INSERT [dbo].[Tran_MachineRawPunch] OFF
SET IDENTITY_INSERT [dbo].[Visitorinfo] ON 

INSERT [dbo].[Visitorinfo] ([id], [NumberofPersons], [VisitorName], [Deptid], [Desigid], [Emailaddress], [ContactNumber], [Address], [ToMeet], [Dateandtime], [FloorNo], [PreparedBy], [VisitorCompany], [Accessories], [Status], [SecurityLevel], [IdProofCategory], [IdProof], [InTime], [Outtime], [NumberofIssueCard], [carddvalidity], [imagepath], [ToMeetid], [visitper], [Remark], [Dept_Names], [Desig_Names]) VALUES (1, NULL, N'sharad', 1, 1, N'', N'9760200500', N'As2002000', N'DEMO/1', NULL, N'', NULL, N'Realtime', N'Laptop', N'Sign In', NULL, N'Voter Id', N'AS2001', CAST(N'2021-03-18 18:45:19.613' AS DateTime), NULL, N'12345', N'00:30', NULL, 2, N'Sales Metting', N'', N'DEMO', N'DEMO')
SET IDENTITY_INSERT [dbo].[Visitorinfo] OFF
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
GO
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
GO
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
GO
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
GO
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (2, 2, 2, 2, 2, 2, 2, 2)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (1, 1, 1, 1, 1, 1, 1, 1)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (3, 3, 3, 3, 3, 3, 3, 3)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (4, 4, 4, 4, 4, 4, 4, 4)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (5, 5, 5, 5, 5, 5, 5, 5)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (6, 6, 6, 6, 6, 6, 6, 6)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (8, 8, 8, 8, 8, 8, 8, 8)
INSERT [dbo].[WeekTimeZone] ([Tz], [sun], [mon], [tue], [wed], [thu], [fri], [sat]) VALUES (7, 7, 7, 7, 7, 7, 7, 7)
ALTER TABLE [dbo].[Loan_Transaction] ADD  CONSTRAINT [DF_Loan_Transaction_ISpaid]  DEFAULT ((0)) FOR [ISpaid]
GO
ALTER TABLE [dbo].[Mst_Bank] ADD  CONSTRAINT [DF_Mst_Bank_Active]  DEFAULT ((1)) FOR [Active]
GO
ALTER TABLE [dbo].[Mst_Bank] ADD  CONSTRAINT [DF_Mst_Bank_On_Date]  DEFAULT (getdate()) FOR [On_Date]
GO
ALTER TABLE [dbo].[Mst_Dates] ADD  CONSTRAINT [DF_Table_1_IProcess]  DEFAULT ((0)) FOR [IsProcess]
GO
ALTER TABLE [dbo].[Mst_EmploymentType] ADD  CONSTRAINT [DF_Mst_EmploymentType_Active]  DEFAULT ((1)) FOR [Active]
GO
ALTER TABLE [dbo].[Mst_EmploymentType] ADD  CONSTRAINT [DF_Mst_EmploymentType_On_Date]  DEFAULT (getdate()) FOR [On_Date]
GO
ALTER TABLE [dbo].[Mst_Grade] ADD  CONSTRAINT [DF_Mst_Grade_Active]  DEFAULT ((1)) FOR [Active]
GO
ALTER TABLE [dbo].[Mst_Grade] ADD  CONSTRAINT [DF_Mst_Grade_On_Date]  DEFAULT (getdate()) FOR [On_Date]
GO
ALTER TABLE [dbo].[Mst_Holiday] ADD  CONSTRAINT [DF_Mst_Holiday_On_Date]  DEFAULT (getdate()) FOR [On_Date]
GO
ALTER TABLE [dbo].[Mst_LeaveType] ADD  CONSTRAINT [DF_Mst_LeaveType_Paid]  DEFAULT ((0)) FOR [Paid]
GO
ALTER TABLE [dbo].[Mst_LeaveType] ADD  CONSTRAINT [DF_Mst_LeaveType_On_Date]  DEFAULT (getdate()) FOR [On_Date]
GO
ALTER TABLE [dbo].[Mst_SalaryDetail] ADD  CONSTRAINT [DF_Mst_SalaryDetail_Advance]  DEFAULT ((0)) FOR [Sub3]
GO
ALTER TABLE [dbo].[Mst_SalaryDetail] ADD  CONSTRAINT [DF_Mst_SalaryDetail_PFNo]  DEFAULT ('') FOR [PFNo]
GO
ALTER TABLE [dbo].[Mst_SalaryDetail] ADD  CONSTRAINT [DF_Mst_SalaryDetail_ESINO]  DEFAULT ('') FOR [ESINO]
GO
ALTER TABLE [dbo].[Mst_SalaryDetail] ADD  CONSTRAINT [DF_Mst_SalaryDetail_IsOvertime]  DEFAULT ((0)) FOR [IsOvertime]
GO
ALTER TABLE [dbo].[Mst_SalaryDetail] ADD  CONSTRAINT [DF_Mst_SalaryDetail_IsDayRate]  DEFAULT ((0)) FOR [IsDayRate]
GO
ALTER TABLE [dbo].[Mst_Section] ADD  CONSTRAINT [DF_Mst_Section_Active]  DEFAULT ((1)) FOR [Active]
GO
ALTER TABLE [dbo].[Mst_Section] ADD  CONSTRAINT [DF_Mst_Section_On_Date]  DEFAULT (getdate()) FOR [On_Date]
GO
ALTER TABLE [dbo].[Mst_SWPolicy] ADD  CONSTRAINT [DF_Mst_SWPolicy_ShiftPatternId]  DEFAULT ('') FOR [ShiftPatternId]
GO
ALTER TABLE [dbo].[Mst_SWPolicy] ADD  CONSTRAINT [DF_Mst_SWPolicy_IsAutoShift]  DEFAULT ((0)) FOR [IsAutoShift]
GO
ALTER TABLE [dbo].[Mst_SWPolicy] ADD  CONSTRAINT [DF_Mst_SWPolicy_Auth_Shifts]  DEFAULT ('') FOR [Auth_Shifts]
GO
ALTER TABLE [dbo].[Mst_SWPolicy] ADD  CONSTRAINT [DF_Mst_SWPolicy_SecondWeekOffDays]  DEFAULT ('') FOR [SecondWeekOffDays]
GO
ALTER TABLE [dbo].[Tran_Daily_Attendance_Temp] ADD  CONSTRAINT [DF_Tran_Daily_Attendance_Temp_Process]  DEFAULT ('N') FOR [Process]
GO
ALTER TABLE [dbo].[Tran_Daily_Attendance_Temp] ADD  CONSTRAINT [DF__Tran_Dail__Machi__32767D0B]  DEFAULT ('1') FOR [MachineNo]
GO
ALTER TABLE [dbo].[Tran_PaidSalaryDetail] ADD  CONSTRAINT [DF_Tran_PaidSalaryDetail_Holidays]  DEFAULT ((0)) FOR [Holidays]
GO
ALTER TABLE [dbo].[Mst_Employee]  WITH CHECK ADD  CONSTRAINT [FK_Mst_Employee_Mst_Branch] FOREIGN KEY([BranchId])
REFERENCES [dbo].[Mst_Branch] ([BranchId])
GO
ALTER TABLE [dbo].[Mst_Employee] CHECK CONSTRAINT [FK_Mst_Employee_Mst_Branch]
GO
ALTER TABLE [dbo].[Mst_Employee]  WITH CHECK ADD  CONSTRAINT [FK_Mst_Employee_Mst_Company] FOREIGN KEY([CompanyId])
REFERENCES [dbo].[Mst_Company] ([CompanyId])
GO
ALTER TABLE [dbo].[Mst_Employee] CHECK CONSTRAINT [FK_Mst_Employee_Mst_Company]
GO
ALTER TABLE [dbo].[Mst_Employee]  WITH CHECK ADD  CONSTRAINT [FK_Mst_Employee_Mst_Dept] FOREIGN KEY([DeptId])
REFERENCES [dbo].[Mst_Department] ([DeptId])
GO
ALTER TABLE [dbo].[Mst_Employee] CHECK CONSTRAINT [FK_Mst_Employee_Mst_Dept]
GO
ALTER TABLE [dbo].[Mst_Employee]  WITH CHECK ADD  CONSTRAINT [FK_Mst_Employee_Mst_Desig] FOREIGN KEY([DesigId])
REFERENCES [dbo].[Mst_Designation] ([DesigId])
GO
ALTER TABLE [dbo].[Mst_Employee] CHECK CONSTRAINT [FK_Mst_Employee_Mst_Desig]
GO
ALTER TABLE [dbo].[Mst_Employee]  WITH CHECK ADD  CONSTRAINT [FK_Mst_Employee_Mst_EmpOfficeTime] FOREIGN KEY([OTimePoliceId])
REFERENCES [dbo].[Mst_EmpOfficeTime] ([OTimePoliceId])
GO
ALTER TABLE [dbo].[Mst_Employee] CHECK CONSTRAINT [FK_Mst_Employee_Mst_EmpOfficeTime]
GO
ALTER TABLE [dbo].[Mst_SalaryDetail]  WITH CHECK ADD  CONSTRAINT [FK_Mst_SalaryDetail_Mst_Employee] FOREIGN KEY([EmpId])
REFERENCES [dbo].[Mst_Employee] ([EmpId])
GO
ALTER TABLE [dbo].[Mst_SalaryDetail] CHECK CONSTRAINT [FK_Mst_SalaryDetail_Mst_Employee]
GO
/****** Object:  StoredProcedure [dbo].[BreakSummaryPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Proc [dbo].[BreakSummaryPrint]
as
begin

SELECT Empcode,
SUBSTRING(
(
SELECT ( ', ' + T1)  	
FROM BreakTable1 t2
WHERE t1.empcode = t2.empcode
ORDER BY t1.empcode, t2.OfficeDate
FOR XML PATH('')
), 3, 1000) as PunchTime,t1.empname,OfficeDate
FROM BreakTable1 t1
GROUP BY Empcode,empname,OfficeDate
end


GO
/****** Object:  StoredProcedure [dbo].[DailyNytReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  Proc [dbo].[DailyNytReport]
as

Begin 

select  Distinct Empname,e.cardno,e.empcode,d.dept_name,CompanyNAme,Branch_name,
convert(Nchar(12),IN1,111)as Datein,
convert(Nchar(5),IN1,108)as Timein,
convert(Nchar(12),OUT2,111)as DateOut,
 convert(Nchar(5),OUT2,108) as TimeOut,
 't' as temp1, 't' as temp2, 't' as temp3, 't' as temp4, 't' as temp5,
  't' as temp6
 from tran_Attendance t,
mst_employee E,
 mst_department d, Temp_empid t1,Mst_company c, Mst_Branch B1
 Where  e.empid=t.empid And e.empid=t1.empid  ANd e.companyid=c.companyId
 And  e.Branchid=b1.BranchId order by e.empcode,e.cardno
 
 End


GO
/****** Object:  StoredProcedure [dbo].[del_table]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[del_table]

as 


delete from mst_leaveapplication


GO
/****** Object:  StoredProcedure [dbo].[delDatafrom_MonthlySummaryTable]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Proc [dbo].[delDatafrom_MonthlySummaryTable]
as
Begin

ALTER TABLE MonthlySummaryTable ADD EmployeeID int identity(1,1) PRIMARY KEY;

WHILE EXISTS (SELECT COUNT(*) FROM MonthlySummaryTable GROUP BY Empcode, DateOffice HAVING COUNT(*) > 1)
BEGIN
    DELETE FROM MonthlySummaryTable WHERE EmployeeID IN 
    (
        SELECT MIN(EmployeeID) as [DeleteID]
        FROM MonthlySummaryTable
        GROUP BY Empcode, DateOffice
        HAVING COUNT(*) > 1
    )
END

end


GO
/****** Object:  StoredProcedure [dbo].[Delete_Map_UserCompany]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Map_UserCompany]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Aug 13 2012
	   Modify Date	: Aug 13 2012
	   Notes	: Delete_Map_UserCompany
*/

          @CompanyId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Map_UserCompany]  WHERE   [CompanyId] = @CompanyId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Bank]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Bank]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_Bank
*/

          @BankID int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Bank]  WHERE   [BankID] = @BankID

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Branch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Branch]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_Branch
*/

          @BranchId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Branch]  WHERE   [BranchId] = @BranchId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Company]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Company]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_Company
*/

          @CompanyId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Company]  WHERE   [CompanyId] = @CompanyId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Department]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Delete_Mst_Department]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 28 2012
	   Modify Date	: Mar 28 2012
	   Notes	: Delete_Mst_Department
*/

          @DeptId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Department]  WHERE   [DeptId] = @DeptId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Designation]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Designation]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012
	   Notes	: Delete_Mst_Designation
*/

          @DesigId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Designation]  WHERE   [DesigId] = @DesigId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Employee]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Employee]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012
	   Notes	: Delete_Mst_Employee
*/

          @EmpId numeric(18,0),
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Employee]  WHERE   [EmpId] = @EmpId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_EmploymentType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_EmploymentType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_EmploymentType
*/

          @EmploymentTypeId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_EmploymentType]  WHERE   [EmploymentTypeId] = @EmploymentTypeId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_EmpOfficeTime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_EmpOfficeTime]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012
	   Notes	: Delete_Mst_EmpOfficeTime
*/

          @OTimePoliceId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_EmpOfficeTime]  WHERE   [OTimePoliceId] = @OTimePoliceId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Grade]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Grade]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_Grade
*/

          @GradeId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Grade]  WHERE   [GradeId] = @GradeId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Holiday]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Holiday]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_Holiday
*/

          @HolidayId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Holiday]  WHERE   [HolidayId] = @HolidayId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_LeaveApplication]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Delete_Mst_LeaveApplication]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_LeaveType
*/

          @RwId  numeric (18,0),
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_LeaveApplication]  WHERE   [RwId] = @RwId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_LeaveType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_LeaveType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_LeaveType
*/

          @LeaveTypeId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_LeaveType]  WHERE   [LeaveTypeId] = @LeaveTypeId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_SalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Delete_Mst_SalaryDetail]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Aug 11 2012
	   Modify Date	: Aug 11 2012
	   Notes	: Delete_Mst_SalaryDetail
*/

          @EmpId numeric(18,0),
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_SalaryDetail]  WHERE   [EmpId] = @EmpId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Section]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Section]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_Section
*/

          @SectionId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Section]  WHERE   [SectionId] = @SectionId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_Shift]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_Shift]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_Shift
*/

          @ShiftId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_Shift]  WHERE   [ShiftId] = @ShiftId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Mst_User]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Mst_User]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012
	   Notes	: Delete_Mst_User
*/

          @User_Id int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Mst_User]  WHERE   [User_Id] = @User_Id

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Tran_MachineRawPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Delete_Tran_MachineRawPunch]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 28 2012
	   Modify Date	: Mar 28 2012
	   Notes	: Delete_Mst_Department
*/

          @Tran_MachineRawPunchId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Tran_MachineRawPunch]  WHERE   [Tran_MachineRawPunchId] = @Tran_MachineRawPunchId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Tran_MachineSetup]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Delete_Tran_MachineSetup]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 18 2012
	   Modify Date	: Apr 18 2012
	   Notes	: Delete_Tran_MachineSetup
*/

          @MCSetupId int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Tran_MachineSetup]  WHERE   [MCSetupId] = @MCSetupId

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Delete_Tran_PaidSalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[Delete_Tran_PaidSalaryDetail]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Aug 11 2012
	   Modify Date	: Aug 11 2012
	   Notes	: Delete_Tran_PaidSalaryDetail
*/

          @MonthNo int,
          @YearNo int,
          @STATUS SMALLINT OUTPUT		 	
		 	
	AS


	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrndelete	
	
		DELETE FROM [Tran_PaidSalaryDetail]  WHERE   [MonthNo] = @MonthNo And [YearNo] = @YearNo

	COMMIT TRAN btrndelete
        SET NOCOUNT OFF
	RETURN 			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrndelete
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Generate_Dates]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE  [dbo].[Generate_Dates]

	as


TRUNCATE TABLE Mst_Dates

DECLARE @var1 INT
DECLARE @DT SMALLDATETIME
SELECT @var1 =1
SELECT @DT ='09/01/2012'

WHILE (@var1 < 4000)
BEGIN
	INSERT INTO Mst_Dates (mDATE) values(@DT)
	select @dt =dateadd(d,1,@DT)	
	select @var1 =@var1 +1
END


GO
/****** Object:  StoredProcedure [dbo].[Get_Employee_Cardno]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[Get_Employee_Cardno](
 @empid int,
@cardno Nvarchar(25) OUTPUT)
AS  
BEGIN 
    SELECT @cardno=cardno from Mst_Employee  where empid=@empid;
			END
	RETURN


GO
/****** Object:  StoredProcedure [dbo].[GetEmpAndCardNo]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Proc [dbo].[GetEmpAndCardNo]
as
begin

select CardNo+'-'+EmpName as empname  from mst_employee where active=1
end


GO
/****** Object:  StoredProcedure [dbo].[GetMachineStatus]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE       PROCEDURE [dbo].[GetMachineStatus]  
   @date datetime   
      
 AS  
  
begin  
  
Select Distinct 'Machine Connected : '  As Status ,MachineNo  from Tran_MachineRawPunch  Where  convert(Nchar(10),punchdatetime,101)=@date  

order by MachineNo desc 
End


GO
/****** Object:  StoredProcedure [dbo].[GetTran_Attendance]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[GetTran_Attendance]
/*
 	   Create by	: Raj kumar
	   Create Date	: Dec 16 2010
	   Modify Date	: Dec 16 2010 
	   Notes	: Select_Tran_MachineRawPunch
*/

          @Empid int 
	AS

		SET NOCOUNT ON
		BEGIN 

			select ROWiD,convert(Nvarchar,DateOffice,103) as ' Date ' ,Shift,ShiftAttended,Status from Tran_attendance where  Empid=@Empid
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[GPSReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CReate Proc [dbo].[GPSReport]
as  
begin 

select G.*,E.empname,e.empcode,e.phoneno,Dis.Desig_name,D.dept_name,b.Branch_Name,
c.companyName ,'t1' as t1,'t2' as t2,'t3' as t3,'t4' as t4,'t5' as t5
 from 
 GprReportRowData  G, mst_employee E, Mst_department 
d,Mst_designation Dis,Mst_Branch B,Mst_company c

Where e.cardno=G.cardno And e.deptid=d.deptid And e.DesigID=Dis.DesigID

And e.branchId=e.branchID And e.companyId=c.companyID And Convert(Nchar(10),Punchdatetime1,101)='03/19/2015'

End


GO
/****** Object:  StoredProcedure [dbo].[Insert_Map_UserCompany]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Insert_Map_UserCompany]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Aug 13 2012
	   Modify Date	: Aug 13 2012 
	   Notes	: Insert_Map_UserCompany
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @CompanyId int,
          @UserId int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Map_UserCompany] WHERE  [CompanyId] = @CompanyId And [UserId] = @UserId ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Map_UserCompany]			
				([CompanyId],[UserId])				
				VALUES				
				(@CompanyId,@UserId)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Bank]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_Bank]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Insert_Mst_Bank
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @Bank_Name Nvarchar(50),
          @Bank_Description Nvarchar(100),
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_Bank] WHERE  [Bank_Name] = @Bank_Name ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_Bank]			
				([Bank_Name],[Bank_Description],[By_User])				
				VALUES				
				(@Bank_Name,@Bank_Description,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Branch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_Branch]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Insert_Mst_Branch
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @Branch_Name Nvarchar(100),
          @Address Nvarchar(200),
          @PhoneNo Nvarchar(100),
          @EmailId Nvarchar(50),
          @By_User int,
          @CompanyId Int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_Branch] WHERE  [Branch_Name] = @Branch_Name ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_Branch]			
				([Branch_Name],[Address],[PhoneNo],[EmailId],[By_User],CompanyId)				
				VALUES				
				(@Branch_Name,@Address,@PhoneNo,@EmailId,@By_User,@CompanyId)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Company]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Insert_Mst_Company]    
/*    
     Create by : Yogendra Singh    
    Create Date : Aug 13 2012    
    Modify Date : Aug 13 2012     
    Notes : Insert_Mst_Company    
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query    
         
    
*/    
    
          @CompanyName Nvarchar(100),    
          @Description Nvarchar(150),    
          @Address Nvarchar(250),    
          @PhoneNo Nvarchar(50),    
          @EmailId Nvarchar(50),    
          @Vat_No Nvarchar(20),    
          @Pf_No Nvarchar(20),    
          @Tan_No Nvarchar(20),    
          @Reg_No Nvarchar(20),    
          @Esi_No Nvarchar(20),    
          @Pan_No Nvarchar(20),    
          @PF numeric(6,2),    
          @FPF numeric(6,2),    
          @ESI numeric(6,2),    
          @Addition1 Nvarchar(30),    
          @Addition2 Nvarchar(30),    
          @Addition3 Nvarchar(30),    
          @Addition4 Nvarchar(30),    
          @Addition5 Nvarchar(30),    
          @Addition6 Nvarchar(30),    
          @Addition7 Nvarchar(30),    
          @Addition8 Nvarchar(30),    
          @Addition9 Nvarchar(30),    
          @Addition10 Nvarchar(30),    
  
          @Ded1 Nvarchar(30),    
          @Ded2 Nvarchar(30),   
          @Ded3 Nvarchar(30),    
          @Ded4 Nvarchar(30),   
          @Ded5 Nvarchar(30),    
  
          @FDed1 Nvarchar(30),    
          @FDed2 Nvarchar(30),   
          @FDed3 Nvarchar(30),    
          @FDed4 Nvarchar(30),   
          @FDed5 Nvarchar(30),  
          @PPF  Decimal(18,2),
          @STATUS SMALLINT OUTPUT    
    
  AS     
      
 SET NOCOUNT ON    
 DECLARE @ErrorNo INT    
     
Begin try       
     
  SELECT @STATUS=0    
     
 BEGIN TRAN btrn      
  IF 0<(SELECT COUNT(*) FROM  [Mst_Company] WHERE  [CompanyName] = @CompanyName )         
      
   BEGIN    
    SELECT @STATUS =1    
    SET NOCOUNT OFF    
    COMMIT TRAN btrn    
    RETURN    
   END        
  ELSE     
      
   BEGIN      
    INSERT INTO [Mst_Company]       
    ([CompanyName],[Description],[Address],[PhoneNo],[EmailId],[Vat_No],[Pf_No],[Tan_No],[Reg_No],[Esi_No],[Pan_No],[PF],[FPF],PPF,[ESI],  
[Addition1],[Addition2],[Addition3],[Addition4],[Addition5],Addition6,Addition7,Addition8,Addition9,Addition10,[Ded1],  
[Ded2],[Ded3],Ded4,Ded5,FDed1,FDed2,FDed3,FDed4,FDed5)        
    VALUES        
    (@CompanyName,@Description,@Address,@PhoneNo,@EmailId,@Vat_No,@Pf_No,@Tan_No,@Reg_No,@Esi_No,@Pan_No,  
@PF,@FPF,@PPF,@ESI,@Addition1,@Addition2,@Addition3,@Addition4,@Addition5,@Addition6,@Addition7,@Addition8,@Addition9,@Addition10,  
@Ded1,@Ded2,@Ded3,@Ded4,@Ded5,@FDed1,@FDed2,@FDed3,@FDed4,@FDed5)        
   END     
 COMMIT TRAN btrn    
 SET NOCOUNT OFF    
 RETURN       
       
End try    
    
BEGIN CATCH    
      
 ErrorHandler:    
 SET NOCOUNT OFF    
 SELECT @STATUS =9    
 ROLLBACK TRAN btrn    
 RETURN     
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Department]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_Department]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012 
	   Notes	: Insert_Mst_Department
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @Dept_Name Nvarchar(100),
          @Dept_Description Nvarchar(150),
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_Department] WHERE  [Dept_Name] = @Dept_Name ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_Department]			
				([Dept_Name],[Dept_Description],[By_User])				
				VALUES				
				(@Dept_Name,@Dept_Description,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Designation]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_Designation]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012 
	   Notes	: Insert_Mst_Designation
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @Desig_Name Nvarchar(50),
          @Desig_Description Nvarchar(100),
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_Designation] WHERE  [Desig_Name] = @Desig_Name ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_Designation]			
				([Desig_Name],[Desig_Description],[By_User])				
				VALUES				
				(@Desig_Name,@Desig_Description,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Employee]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[Insert_Mst_Employee]    
/*    
     Create by : Sharad Kumar    
    Create Date : Apr 12 2012    
    Modify Date : Apr 12 2012     
    Notes : Insert_Mst_Employee    
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query    
         
    
*/    
    
          @EmpName Nvarchar(50),    
          @FatherName Nvarchar(50),    
          @EmpCode Nvarchar(10),    
          @pwd     Nvarchar(50),    
          @CardNo Nvarchar(10),    
          @CompanyId int,    
          @DeptId int,    
          @DesigId int,    
          @BranchId int,    
          @OTimePoliceId int,    
          @DateofJoin smalldatetime,    
          @ShiftId int,    
          @ShiftType Nvarchar(10),    
          @ShiftPatternId Nvarchar(50),    
              
             
          @SuperiourName int,    
          @IsAutoShift bit,    
          @Auto_Shifts Nvarchar(50),    
          @FirstOffDay Nchar(15),    
          @SecondOffDayType Nvarchar(5),    
          @SecondOffDay Nchar(15),    
          @HalfDayShiftId int,    
          @SecondWeekOffDays Nvarchar(20),    
          @ShiftRemaindays int,    
          @CDays int,    
          @ShiftStartDate smalldatetime,    
          @ShiftCode Nchar(3),    
          @HalfDayShiftCode Nchar(3),    
              
          @By_User int,    
          @EmailAddress Nvarchar(150),    
          @BSalary numeric(18, 0),    
          @STATUS SMALLINT OUTPUT    
    
  AS     
      
 SET NOCOUNT ON    
 DECLARE @ErrorNo INT    
     
--Begin try       
     
  SELECT @STATUS=0    
Select * from  Mst_Employee      
  
 BEGIN TRAN btrn      
  IF 0<(SELECT COUNT(*) FROM  [Mst_Employee] WHERE [Empcode] =@EmpCode or Cardno=@CardNo  )         
      
   BEGIN    
    SELECT @STATUS =-1    
    SET NOCOUNT OFF    
    COMMIT TRAN btrn    
    RETURN    
   END        
  ELSE     
      
   BEGIN      
    INSERT INTO [Mst_Employee]       
    ([EmpName],[FatherName],[EmpCode],[pwd],[CardNo],[CompanyId],[DeptId],[DesigId],[BranchId],[OTimePoliceId],[DateofJoin],[ShiftId],[ShiftType],[ShiftPatternId],[SuperiourName],[IsAutoShift],[Auto_Shifts],[FirstOffDay],[SecondOffDayType],[SecondOffDay],
  
[HalfDayShiftId],[SecondWeekOffDays],[ShiftRemaindays],[CDays],[ShiftStartDate],[ShiftCode],[HalfDayShiftCode],[ImagePath],[By_User],[ReginDate],[EmailAddress],[BSalary])        
    VALUES        
    (@EmpName,@FatherName,@EmpCode,@pwd,@CardNo,@CompanyId,@DeptId,@DesigId,@BranchId,@OTimePoliceId,@DateofJoin,@ShiftId,@ShiftType,@ShiftPatternId,@SuperiourName,@IsAutoShift,@Auto_Shifts,@FirstOffDay,@SecondOffDayType,@SecondOffDay,@HalfDayShiftId,  
@SecondWeekOffDays,@ShiftRemaindays,@CDays,@ShiftStartDate,@ShiftCode,@HalfDayShiftCode,' ',@By_User,'',@EmailAddress,@BSalary)      
        


    select @STATUS =@@identity    
   END     
 COMMIT TRAN btrn    
 SET NOCOUNT OFF    
 RETURN       
       
--End try    
    
--BEGIN CATCH    
      
 ErrorHandler:    
 SET NOCOUNT OFF    
 SELECT @STATUS =9    
 ROLLBACK TRAN btrn    
 RETURN     
--END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_EmploymentType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_EmploymentType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Insert_Mst_EmploymentType
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @EmploymentTypeName Nvarchar(50),
          @EmploymentTypeDesc Nvarchar(100),
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_EmploymentType] WHERE  [EmploymentTypeName] = @EmploymentTypeName ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_EmploymentType]			
				([EmploymentTypeName],[EmploymentTypeDesc],[By_User])				
				VALUES				
				(@EmploymentTypeName,@EmploymentTypeDesc,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_EmpOfficeTime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_EmpOfficeTime]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Insert_Mst_EmpOfficeTime
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @OfficeTimePolicyName Nvarchar(40),
          @LateHour numeric(6,2),
          @EarlyHour numeric(6,2),
          @DayMaxworkHour numeric(6,2),
          @PresentDuration numeric(6,2),
          @HalfDayWorkHour numeric(6,2),
          @HalfDayAbsentHour numeric(6,2),
          @RoundClock bit,
          @TimeLoss bit,
          @HalfDay bit,
          @ShortLeave bit,
          @OverStay bit,
          @OverTime bit,
          @OTRate numeric(8,2),
          @RequiredPunch smallint,
          @SinglePunchValue numeric(8,0),
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_EmpOfficeTime] WHERE  [OfficeTimePolicyName] = @OfficeTimePolicyName ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_EmpOfficeTime]			
				([OfficeTimePolicyName],[LateHour],[EarlyHour],[DayMaxworkHour],[PresentDuration],[HalfDayWorkHour],[HalfDayAbsentHour],[RoundClock],[TimeLoss],[HalfDay],[ShortLeave],[OverStay],[OverTime],[OTRate],[RequiredPunch],[SinglePunchValue],[By_User])				
				VALUES				
				(@OfficeTimePolicyName,@LateHour,@EarlyHour,@DayMaxworkHour,@PresentDuration,@HalfDayWorkHour,@HalfDayAbsentHour,@RoundClock,@TimeLoss,@HalfDay,@ShortLeave,@OverStay,@OverTime,@OTRate,@RequiredPunch,@SinglePunchValue,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Grade]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_Grade]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Insert_Mst_Grade
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @Grade_Nme Nvarchar(50),
          @Grade_Description Nvarchar(100),
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_Grade] WHERE  [Grade_Nme] = @Grade_Nme ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_Grade]			
				([Grade_Nme],[Grade_Description],[By_User])				
				VALUES				
				(@Grade_Nme,@Grade_Description,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Holiday]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_Holiday]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Insert_Mst_Holiday
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @HolidayName Nvarchar(50),
          @HolidayDate smalldatetime,
          @CompId int,
          @Description Nvarchar(100),
          @IsAdjustment bit,
          @AdjustmentDate smalldatetime,
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
		if @AdjustmentDate ='01/01/1900'
		begin
			select @AdjustmentDate =null
		end
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_Holiday] WHERE  [HolidayName] = @HolidayName And [HolidayDate] = @HolidayDate And [CompId] = @CompId ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_Holiday]			
				([HolidayName],[HolidayDate],[CompId],[Description],[IsAdjustment],[AdjustmentDate],[By_User])				
				VALUES				
				(@HolidayName,@HolidayDate,@CompId,@Description,@IsAdjustment,@AdjustmentDate,@By_User)				
				
				update Tran_Attendance set Status='HLD',Holiday_value=1,absentvalue=0,presentvalue=0,leavevalue=0
				from tran_attendance a,mst_employee b where a.empid=b.empid and a.dateoffice =@HolidayDate


		END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_LeaveApplication]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_LeaveApplication]


         ( @EmpId Nvarchar(10),
          @Fromdate datetime,
          @Todate datetime,
          @Reason Nvarchar(100),
          @Leaveid int,
          @Dur1 Nvarchar(25),
		  @Dur2 Nvarchar(25),
		  @Dur3 Nvarchar(25),
		  @Dur4 Nvarchar(25),
          @ApprovedStatus Nvarchar(25),
          @ApprovedBy int,
          @ApplicationDate datetime)
         

	 AS 
	 
	
	      BEGIN		
				INSERT INTO Mst_LeaveApplication (EmpId,Fromdate,Todate,Reason,Leaveid,Dur1, Dur2, Dur3, Dur4, ApprovedStatus, ApprovedBy, ApplicationDate)				
				VALUES				
				(@EmpId,@Fromdate,@Todate,@Reason,@Leaveid,@Dur1, @Dur2, @Dur3, @Dur4,@ApprovedStatus, @ApprovedBy, @ApplicationDate)				
			END	


--END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_LeaveType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_LeaveType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Insert_Mst_LeaveType
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @LTypeCode Nvarchar(20),
          @LTypeName Nvarchar(50),
          @WeekOff bit,
          @Holiday bit,
          @IsAccrual bit,
          @AccrualType Nvarchar(50),
          @Fixmin decimal(6,2),
          @Fixmax decimal(6,2),
          @CarryPresent decimal(6,2),
          @CarryLeave decimal(6,2),
          @MaxAccrual decimal(6,2),
          @Paid bit,
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_LeaveType] WHERE  [LTypeCode] = @LTypeCode ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_LeaveType]			
				([LTypeCode],[LTypeName],[WeekOff],[Holiday],[IsAccrual],[AccrualType],[Fixmin],[Fixmax],[CarryPresent],[CarryLeave],[MaxAccrual],[Paid],[By_User])				
				VALUES				
				(@LTypeCode,@LTypeName,@WeekOff,@Holiday,@IsAccrual,@AccrualType,@Fixmin,@Fixmax,@CarryPresent,@CarryLeave,@MaxAccrual,@Paid,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_SalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE    PROCEDURE [dbo].[Insert_Mst_SalaryDetail]           
        
          @EmpId numeric(18,0),          
          @Addition1 numeric(10,2),          
          @Addition2 numeric(10,2),          
          @Addition3 numeric(10,2),          
          @Addition4 numeric(10,2),          
          @Addition5 numeric(10,2),          
          @Addition6 numeric(10,2),          
          @Addition7 numeric(10,2),          
          @Addition8 numeric(10,2),          
          @Addition9 numeric(10,2),          
          @Addition10 numeric(10,2),          
        
          @Ded1 numeric(10,2),          
          @Ded2 numeric(10,2),          
          @Ded3 numeric(10,2),           
          @Ded4 numeric(10,2),         
          @Ded5 numeric(10,2),          
        
          @FDed1 numeric(10,2),          
          @FDed2 numeric(10,2),          
          @FDed3 numeric(10,2),           
          @FDed4 numeric(10,2),         
          @FDed5 numeric(10,2),          
        
          @PFNo Nvarchar(20),          
          @ESINO Nvarchar(20),          
          @IsOvertime bit,          
          @salmod bit,       
         
          @IsEsi1 bit,      
          @IsPf1 bit,      
          @IsOt1 bit,      
      
          @IsEsi2 bit,      
          @IsPf2 bit,      
          @IsOt2 bit,      
      
          @IsEsi3 bit,      
          @IsPf3 bit,      
          @IsOt3 bit,      
      
          @IsEsi4 bit,      
          @IsPf4 bit,      
          @IsOt4 bit,      
      
          @IsEsi5 bit,      
          @IsPf5 bit,      
          @IsOt5 bit,      
      
          @IsEsi6 bit,      
          @IsPf6 bit,      
          @IsOt6 bit,      
      
          @IsEsi7 bit,      
          @IsPf7 bit,      
          @IsOt7 bit,      
      
          @IsEsi8 bit,      
          @IsPf8 bit,      
          @IsOt8 bit,      
      
          @IsEsi9 bit,      
          @IsPf9 bit,      
          @IsOt9 bit,      
      
      
      
          @IsEsi10 bit,      
          @IsPf10 bit,      
          @IsOt10 bit,     
    
          @PF decimal(18,2),    
          @EPF decimal(18,2),    
          @PPF decimal(18,2),    
          @ESI decimal(18,2),   
          @OtRate decimal(18,2),   
          @TdsAmt  decimal(18,2),   
          @TdsPer  decimal(18,2),   
      
      
             
          @STATUS SMALLINT OUTPUT          
          
  AS           
            
 SET NOCOUNT ON          
 DECLARE @ErrorNo INT          
           
Begin try             
           
  SELECT @STATUS=0          
           
 BEGIN TRAN btrn            
  IF 0<(SELECT COUNT(*) FROM  [Mst_SalaryDetail]  WHERE  [EmpId] = @EmpId )               
            
   BEGIN          
    SELECT @STATUS =1          
    SET NOCOUNT OFF          
    COMMIT TRAN btrn          
    RETURN          
   END              
  ELSE           
            
   BEGIN            
    INSERT INTO [Mst_SalaryDetail]             
    ([EmpId],[Addition1],[Addition2],[Addition3],[Addition4],[Addition5],[Addition6],[Addition7],[Addition8],[Addition9],[Addition10],        
[sub1],[sub2],[sub3],[sub4],[sub5],FDed1,FDed2,FDed3,FDed4,FDed5,[PFNo],[ESINO],[IsOvertime],[IsDayRate],      
IsEsi1,IsPf1,IsOt1,IsEsi2,IsPf2,IsOt2,IsEsi3,IsPf3,IsOt3 ,IsEsi4,IsPf4 ,IsOt4 ,      
IsEsi5 ,IsPf5 ,IsOt5 ,IsEsi6 ,IsPf6 ,IsOt6 ,IsEsi7 ,IsPf7 ,IsOt7 ,IsEsi8 ,IsPf8 ,IsOt8 ,      
IsEsi9 ,IsPf9 ,IsOt9 ,IsEsi10 ,IsPf10 ,IsOt10,PF,EPF,PPF,ESI ,OtRate,TdsAmt,TdsPer)              
    VALUES              
  (@EmpId,@Addition1,@Addition2,@Addition3,@Addition4,@Addition5,@Addition6,@Addition7,@Addition8,@Addition9,@Addition10,        
 @Ded1,   @Ded2,  @Ded3,  @Ded4,   @Ded5,@FDed1,@FDed2,@FDed3,@FDed4,@FDed5,@PFNo,@ESINO,@IsOvertime,@salmod,      
 @IsEsi1 ,@IsPf1 ,@IsOt1 ,@IsEsi2 ,@IsPf2 ,@IsOt2 ,@IsEsi3,@IsPf3 ,@IsOt3 ,@IsEsi4 ,@IsPf4 ,@IsOt4,      
 @IsEsi5 ,@IsPf5 ,@IsOt5 ,@IsEsi6 ,@IsPf6 ,@IsOt6 ,@IsEsi7,@IsPf7 ,@IsOt7 ,@IsEsi8 ,@IsPf8 ,@IsOt8,      
 @IsEsi9 ,@IsPf9 ,@IsOt9 ,@IsEsi10 ,@IsPf10 ,@IsOt10,@PF,@EPF,@PPF,@ESI,@OtRate,@TdsAmt,@TdsPer)              
   END           
 COMMIT TRAN btrn          
 SET NOCOUNT OFF          
 RETURN             
             
End try          
          
BEGIN CATCH          
            
 ErrorHandler:          
 SET NOCOUNT OFF          
 SELECT @STATUS =9          
 ROLLBACK TRAN btrn          
 RETURN           
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Section]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_Section]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Insert_Mst_Section
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @Section_Name Nvarchar(50),
          @Section_Description Nvarchar(100),
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_Section] WHERE  [Section_Name] = @Section_Name ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_Section]			
				([Section_Name],[Section_Description],[By_User])				
				VALUES				
				(@Section_Name,@Section_Description,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_Shift]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_Shift]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Insert_Mst_Shift
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @ShiftCode Nvarchar(10),
          @ShiftName Nvarchar(25),
          @StartTime numeric(6,2),
          @EndTime numeric(6,2),
          @ShiftDuration numeric(6,2),
          @Break1Begun numeric(6,2),
          @Break1End numeric(6,2),
          @Break1Duration numeric(6,2),
          @Break2Begun numeric(6,2),
          @Break2End numeric(6,2),
          @Break2Duration numeric(6,2),
        
          @By_User int,
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Mst_Shift] WHERE  [ShiftCode] = @ShiftCode ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Mst_Shift]			
				([ShiftCode],[ShiftName],[StartTime],[EndTime],[ShiftDuration],[Break1Begun],[Break1End],[Break1Duration],[Break2Begun],[Break2End],[Break2Duration],[By_User])				
				VALUES				
				(@ShiftCode,@ShiftName,@StartTime,@EndTime,@ShiftDuration,@Break1Begun,@Break1End,@Break1Duration,@Break2Begun,@Break2End,@Break2Duration,@By_User)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Mst_User]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Mst_User]      
/*      
     Create by : Yogendra Singh      
    Create Date : Mar 30 2012      
    Modify Date : Mar 30 2012       
    Notes : Insert_Mst_User      
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query      
           
      
*/      
    
          @User_Login_Id Nvarchar(25),      
          @User_Name Nvarchar(50),      
          @User_Password Nvarchar(25),      
          @Parent_User_Id int,      
          @User_Enabled bit,      
          @email Nvarchar(50),      
          @Mobile Nvarchar(50),      
          @per Nvarchar(200),     
          @branchper Nvarchar(200),     
          @companyper Nvarchar(200),  
          @STATUS SMALLINT OUTPUT      
      
  AS       
        
 SET NOCOUNT ON      
 DECLARE @ErrorNo INT      
       
Begin try         
       
  SELECT @STATUS=0      
       
 BEGIN TRAN btrn        
  IF 0<(SELECT COUNT(*) FROM  [Mst_User] WHERE  [User_Login_Id] = @User_Login_Id )           
        
   BEGIN      
    SELECT @STATUS =1      
    SET NOCOUNT OFF      
    COMMIT TRAN btrn      
    RETURN      
   END          
  ELSE       
        
   BEGIN        
    INSERT INTO [Mst_User]         
    ([User_Login_Id],[User_Name],[User_Password],[Parent_User_Id],[User_Enabled],[email],[Mobile],[per],[branch_per],Company_per)          
    VALUES          
    (@User_Login_Id,@User_Name,@User_Password,@Parent_User_Id,@User_Enabled,@email,@Mobile,@per,@branchper,@companyper)          
   END       
 COMMIT TRAN btrn      
 SET NOCOUNT OFF      
 RETURN         
         
End try      
      
BEGIN CATCH      
        
 ErrorHandler:      
 SET NOCOUNT OFF      
 SELECT @STATUS =9      
 ROLLBACK TRAN btrn      
 RETURN       
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_MstDates]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Insert_MstDates]
as 
DECLARE @var1 INT
DECLARE @DT SMALLDATETIME
SELECT @var1 =1
SELECT @DT ='01/01/'+ CAST(YEAR(GETDATE()) AS NCHAR(4))

SELECT @var1 =isnull(COUNT(*),0) from Mst_Dates where year(MDate) =year(@DT)

if @var1 =0
	
begin
    select @var1 =1
	WHILE (@var1 < 367)
	BEGIN
		INSERT INTO Mst_Dates (MDate) values(@DT)
		select @dt =dateadd(d,1,@DT)	
		select @var1 =@var1 +1
	 
	END	
	
	DELETE FROM Mst_Dates WHERE YEAR(MDate) = YEAR(GETDATE())+1
end


GO
/****** Object:  StoredProcedure [dbo].[Insert_PunchTime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[Insert_PunchTime]  
/*  
     Create by : Yogendra Singh  
    Create Date : Aug 31 2010  
    Modify Date : Aug 31 2010   
    Notes : Insert_Mst_Desig  
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query  
       
  
*/  
  
         
  AS   
    
 SET NOCOUNT ON  
 DECLARE @ErrorNo INT  
   
Begin try     
   
    
   
 BEGIN TRAN btrn    
  
   delete from dbo.Tran_Daily_Attendance_Temp from dbo.Tran_Daily_Attendance_Temp a,dbo.Tran_MachineRawPunch b  
   where a.cardno =b.cardno and a.punchdatetime=b.punchdatetime  
  
   insert into dbo.Tran_MachineRawPunch(CardNo,PunchDatetime,P_Day,ISManual,PayCode,[MachineNo])  
   select CardNo,PunchDatetime,'N','N','',[MachineNo] from Tran_Daily_Attendance_Temp order by cardno,PunchDatetime  
     
   truncate table dbo.Tran_Daily_Attendance_Temp  
  
        
 COMMIT TRAN btrn  
 SET NOCOUNT OFF  
 RETURN     
     
End try  
  
BEGIN CATCH  
    
 ErrorHandler:  
 SET NOCOUNT OFF  
 ROLLBACK TRAN btrn  
 RETURN   
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Tran_MachineRawPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Tran_MachineRawPunch]
/*
 	   Create by	: Raj kumar
	   Create Date	: Dec 16 2010
	   Modify Date	: dec 16 2010 
	   Notes	: Insert_Tran_MachineRawPunch
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @CardNo NVarchar(10),
          @PunchDatetime Smalldatetime,
          @P_Day NChar(1),
          @ISManual NChar(1),
          @PayCode NVarchar(50),
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Tran_MachineRawPunch] WHERE [CardNo] =@CardNo and   [PunchDatetime] = @PunchDatetime ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Tran_MachineRawPunch]			
				([CardNo],[PunchDatetime],[P_Day],[ISManual],[PayCode])				
				VALUES				
				(@CardNo,@PunchDatetime,@P_Day,@ISManual,@PayCode)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Tran_MachineSetup]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Insert_Tran_MachineSetup]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 18 2012
	   Modify Date	: Apr 18 2012 
	   Notes	: Insert_Tran_MachineSetup
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/

          @McTypeId int,
          @TypeName Nvarchar(50),
          @PortNo int,
          @MCNo int,
          @IPAddress Nvarchar(20),
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
		select @PortNo =PortNo from Mst_MachineType where McTypeId =@McTypeId


	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Tran_MachineSetup] WHERE  [TypeName] = @TypeName And [MCNo] = @MCNo ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				INSERT INTO [Tran_MachineSetup]			
				([McTypeId],[TypeName],[PortNo],[MCNo],[IPAddress])				
				VALUES				
				(@McTypeId,@TypeName,@PortNo,@MCNo,@IPAddress)				
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Insert_Tran_PaidSalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE     PROCEDURE [dbo].[Insert_Tran_PaidSalaryDetail]          
/*          
     Create by : SHarad Baliyan          
    Create Date : Aug 20 2012          
    Modify Date : Aug 20 2012           
    Notes : Insert_Tran_PaidSalaryDetail          
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query          
               
          
*/          
          
          @EmpId numeric(18,0),          
          @MonthNo int,          
          @YearNo int,          
          @MonthDay int,          
          @Present numeric(5,2),          
          @Absent numeric(5,2),          
          @WeeklyOff numeric(5,2),          
          @Holidays numeric(5,2),          
          @PaidLeave numeric(5,2),          
          @PayDays numeric(5,2),          
          @Addtion1_Rate numeric(12,2),          
          @Addition2_Rate numeric(12,2),          
          @Addition3_Rate numeric(12,2),          
          @Addition4_Rate numeric(12,2),          
          @Addition5_Rate numeric(12,2),        
          @Addtion6_Rate numeric(12,2),          
          @Addition7_Rate numeric(12,2),          
          @Addition8_Rate numeric(12,2),          
          @Addition9_Rate numeric(12,2),          
          @Addition10_Rate numeric(12,2),       
        
          @Addition1_Paid numeric(12,2),          
          @Addition2_Paid numeric(12,2),          
          @Addition3_Paid numeric(12,2),          
          @Addition4_Paid numeric(12,2),          
          @Addition5_Paid numeric(12,2),         
          @Addition6_Paid numeric(12,2),          
          @Addition7_Paid numeric(12,2),          
          @Addition8_Paid numeric(12,2),          
          @Addition9_Paid numeric(12,2),          
          @Addition10_Paid numeric(12,2),          
      
          @PF_Ded numeric(12,2),          
          @EPF_Ded numeric(12,2),        
          @PPF_Ded numeric(12,2),           
          @ESI_Ded numeric(12,2),       
         
          @Ded1_Rate numeric(12,2),          
          @Ded3_Rate numeric(12,2),          
          @Ded2_Rate numeric(12,2),      
          @Ded4_Rate numeric(12,2),          
          @Ded5_Rate numeric(12,2),      
      
          @Ded1_Ded numeric(12,2),          
          @Ded2_Ded numeric(12,2),          
          @Ded3_Ded numeric(12,2),      
          @Ded4_Ded numeric(12,2),          
          @Ded5_Ded numeric(12,2),       
      
          @FDed1 numeric(12,2),          
          @FDed2 numeric(12,2),          
          @FDed3 numeric(12,2),      
          @FDed4 numeric(12,2),          
          @FDed5 numeric(12,2),        
          @TdsAmountVal numeric(12,2),        
          @TdsRate numeric(12,2),        
          @TDsAmt numeric(12,2),      
          @OTHours Nvarchar(40),          
          @OTRate numeric(10,2),          
          @OTAmount numeric(12,2),          
          @Tota_Earning numeric(12,2),          
          @Total_Ded numeric(12,2),          
          @NetPay numeric(12,2),     
          @Amtinword Nvarchar(500),          
          @STATUS SMALLINT OUTPUT          
          
  AS           
            
 SET NOCOUNT ON          
 DECLARE @ErrorNo INT          
           
Begin try             
           
  SELECT @STATUS=0          
           
 BEGIN TRAN btrn            
  IF 0<(SELECT COUNT(*) FROM  [Tran_PaidSalaryDetail] WHERE  [EmpId] = @EmpId And [MonthNo] = @MonthNo And [YearNo] = @YearNo )               
            
   BEGIN          
    SELECT @STATUS =1          
    SET NOCOUNT OFF          
    COMMIT TRAN btrn          
    RETURN          
   END              
  ELSE           
            
   BEGIN            
    INSERT INTO [Tran_PaidSalaryDetail]             
    ([EmpId],[MonthNo],[YearNo],[MonthDay],[Present],[Absent],[WeeklyOff],[Holidays],[PaidLeave],[PayDays],      
[Addtion1_Rate],[Addition2_Rate],[Addition3_Rate],[Addition4_Rate],[Addition5_Rate],[Addition6_Rate],[Addition7_Rate],[Addition8_Rate],[Addition9_Rate],[Addition10_Rate],      
[Addition1_Paid],[Addition2_Paid],[Addition3_Paid],[Addition4_Paid],[Addition5_Paid],[Addition6_Paid],[Addition7_Paid],[Addition8_Paid],[Addition9_Paid],[Addition10_Paid],      
Ded1_Rate,Ded2_Rate,Ded3_Rate,Ded4_Rate,Ded5_Rate,[Ded1_Ded],[Ded2_Ded],[Ded3_Ded],[Ded4_Ded],[Ded5_Ded],      
FDed1,FDed2,FDed3,FDed4,FDed5      
,[PF_Ded],[EPF_Ded],[PPF_Ded],[ESI_Ded],[OTHours],[OTRate],[OTAmount],[Tota_Earning],[Total_Ded],[NetPay],TdsAmountVal,TdsRate,TDsAmt,Amtinword)              
    VALUES              
    (@EmpId,@MonthNo,@YearNo,@MonthDay,@Present,@Absent,@WeeklyOff,@Holidays,@PaidLeave,@PayDays,      
@Addtion1_Rate,@Addition2_Rate,@Addition3_Rate,@Addition4_Rate,@Addition5_Rate,@Addtion6_Rate,@Addition7_Rate,@Addition8_Rate,@Addition9_Rate,@Addition10_Rate,      
@Addition1_Paid,@Addition2_Paid,@Addition3_Paid,@Addition4_Paid,@Addition5_Paid,@Addition6_Paid,@Addition7_Paid,@Addition8_Paid,@Addition9_Paid,@Addition10_Paid,      
 @Ded1_Rate,@Ded2_Rate,@Ded3_Rate,@Ded4_Rate,@Ded5_Rate,@Ded1_Ded,@Ded2_Ded,@Ded3_Ded,@Ded4_Ded,@Ded5_Ded,      
@FDed1,@FDed2,@FDed3,@FDed4,@FDed5,      
       
@PF_Ded,@EPF_Ded,@PPF_Ded,@ESI_Ded,@OTHours,@OTRate,@OTAmount,@Tota_Earning,@Total_Ded,@NetPay,@TdsAmountVal,@TdsRate,@TDsAmt,@Amtinword)              
   END           
 COMMIT TRAN btrn          
 SET NOCOUNT OFF          
 RETURN             
             
End try          
          
BEGIN CATCH          
            
 ErrorHandler:          
 SET NOCOUNT OFF          
 SELECT @STATUS =9          
 ROLLBACK TRAN btrn          
 RETURN           
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[InsertEmpId]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[InsertEmpId]
	
		@KeywordList		nvarchar(max)
		
	As
	Declare @Cntr		Int
		Declare @Value		Int
		Declare @Strlen 	Int
		Declare @Varmailid	NVarchar(50)
		Declare @Scanchar	NVarchar(50)
		Declare @Str		Nvarchar(300)
		Declare @DelStatus	Int	
		Declare @Keyword_Id Int
		Declare @Instatus 	int
		
		Select @KeywordList = '|'+Ltrim(Rtrim(@KeywordList))
	
		Select @Cntr = 0
	
		Select @Strlen = Len(@KeywordList) + 1
		
		truncate table  Temp_EmpId
	
		While (@Cntr < @Strlen)
		Begin
			Select @Cntr = @Cntr + 1
	
			Select @Scanchar = Substring ( @KeywordList, @Cntr ,1) 	
	
			If @Scanchar = '|'
				Begin
					IF LTRIM(RTRIM(@Varmailid))<>''
						BEGIN
							INSERT INTO [Temp_EmpId] (EmpID) values(@Varmailid)
						END
					Select @Varmailid = ''		
				End
			Else
				Begin
					Select @Varmailid = @Varmailid + @Scanchar
				End			
		End


GO
/****** Object:  StoredProcedure [dbo].[LocationDataWithPhoto]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Proc [dbo].[LocationDataWithPhoto]  
as  
Begin  
  
select G.*,E.empname,e.empcode,e.phoneno,Dis.Desig_name,D.dept_name,  
b.Branch_Name,c.companyName ,convert(Nchar(5),G.Punchdatetime,108)   
as t1,convert(Nchar(8),G.Punchdatetime,108) as t2,'t3' as t3,convert(Nchar(10)  
,g.punchdatetime,108) as t4,g.location  as t5 from Tran_ManualPunch_loc  G,  
 mst_employee E, Mst_department  d,Mst_designation Dis,Mst_Branch B,Mst_company  
  c Where e.cardno=G.cardno And e.deptid=d.deptid And e.DesigID=Dis.DesigID   
  And e.branchId=e.branchID And e.companyId=c.companyID  And ImageData is not null   
    
    
  End


GO
/****** Object:  StoredProcedure [dbo].[login_For_Employee]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[login_For_Employee]
(@Empid Nvarchar(20) ,@pwd Nvarchar(20))
as

Begin


Select * from mst_Employee where empcode=@Empid and pwd=@pwd



end


GO
/****** Object:  StoredProcedure [dbo].[MonthlyOTSummary]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[MonthlyOTSummary]
@fordate smalldatetime,
@toDate smalldatetime
as
begin
SELECT c.empname,c.empcode ,c.cardno,dbo.convertTime(sum(a.OTDURATION)) AS [OT Duration], sum(a.OTAMOUNT) AS [OT Amount], dbo.convertTime(sum(a.OSDURATION)) AS [Over Stay], 
B.Dept_Name  as Department,sum(a.OTDURATION) as computeOT,max(@fordate) as [Fordate],max(@todate) as  [Todate]
from realsoft.tran_attendance a,Mst_Department b,mst_employee c,Temp_EmpId e
where a.empid =c.empid and b.deptid =c.deptid and a.EmpId = e.EmpId
and convert(Nvarchar(8),a.dateoffice,112) between convert(Nvarchar(8),@fordate,112) and convert(Nvarchar(8),@todate,112)
group by b.Dept_Name ,a.dateoffice,c.empname,c.empcode ,c.cardno
having sum(a.OTDURATION) > 0
 
end


GO
/****** Object:  StoredProcedure [dbo].[MonthlyPerformanceWithLeaveReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure  [dbo].[MonthlyPerformanceWithLeaveReport]        
    
@fordate smalldatetime,          
@ToDate smalldatetime          
as          
begin          
     
    
select e.EmpCode as PayCode,e.CardNo ,e.EmpName as [EmployeeName],d.Dept_Name as Department,b.Branch_Name,     
sum(presentvalue) as Present,sum(absentvalue) as Absent,SUM(t.OTDuration) AS cOTDuration ,    
dbo.convertTime(sum(t.OTDuration)) as OverTime,convert(Nchar(10),max(@fordate),103) as [Fordate],convert(Nchar(10),max(@todate),103) as    
      
[Todate] ,'temp1' as temp1,  'temp2' as temp2, 'temp3' as temp3, 'temp4' as temp4,      
'temp5' as temp5,'temp6' as temp6     
    
 from Tran_Attendance t , mst_employee e,Mst_Branch b,Mst_Department d where t.EmpId=e.EmpId    
 and b.BranchId=e.BranchId and d.DeptId=e.DeptId and convert(Nvarchar(10),t.dateoffice,101)     
 between convert(Nvarchar,@fordate,101)      
 and convert(Nvarchar(10),@ToDate,101)   group by t.EmpId ,e.EmpCode,e.CardNo ,e.EmpName ,d.Dept_Name,b.Branch_Name    
     
 End


GO
/****** Object:  StoredProcedure [dbo].[Seelct_In_Out_Table_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   Procedure [dbo].[Seelct_In_Out_Table_Print]  
(@Date Nvarchar(10))    
    
as    
Begin    
    
Select  A.Cardno,Convert(Nchar(10),a.OfficeDate,103) as OfficeDate,    
Convert(Nchar(5),a.InTIme,108) as InTIme,Convert(Nchar(5),a.OutTime,108) as OutTime,    
Convert(Nchar(5),a.TotalDur,108) as TotalDur,    
 Empname,EMpcode,c.Dept_Name,d.Desig_name,e.CompanyName,srno as Temp1,'Temp1' as Temp2,'Temp1' as Temp3,'Temp1' as Temp3    
,'Temp1' as Temp4    
   from  All_In_Out_Table a,     
mst_employee b,mst_department c ,Mst_designation d ,Mst_company e    
Where a.Cardno=b.cardno and b.deptId=c.deptId and b.desigid=d.DesigId and b.companyId=e.companyId    
ANd Convert(Nchar(10),a.OfficeDate,103)=@Date    
    
ENd


GO
/****** Object:  StoredProcedure [dbo].[Select_All_DutyReg]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE          procedure [dbo].[Select_All_DutyReg]       
@fordate smalldatetime,      
@ToDate smalldatetime  ,    
@Empid  int    
as      
begin      
 select RowId,Shift,convert(Nchar(10),DateOffice,101) as DateOffice from   dbo.Tran_Attendance       
where convert(Nvarchar,dateoffice,112) between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@ToDate,112)       
and   Empid=@Empid order By  dateoffice      
      
end


GO
/****** Object:  StoredProcedure [dbo].[Select_All_Temp_Lunch_Report_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Select_All_Temp_Lunch_Report_Print]  
(@frdt dateTime,  
 @trdt DateTime)  
  
as  
  
Begin  
  
  
Select  a.empid,b.CardNo as  empcode,b.EmpName,c.Dept_Name,Convert(Nchar(10),a.PunchDateTime,101) as PunchDateTime   
,convert(Nchar(5),a.InTIme,108) as InTIme ,convert(Nchar(5),a.OutTime,108) as OutTime ,convert(Nchar(5),a.OutTime-a.InTIme,108) as TotalTime,'temp1' as temp1,'temp2' as Temp2  
 ,'Temp3' as temp3 from  Temp_Lunch_Report a,Mst_Employee b ,Mst_Department c  
 Where a.empid=b.EmpId   and b.DeptId=c.DeptId   
  
End


GO
/****** Object:  StoredProcedure [dbo].[Select_AllEmployeeId]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_AllEmployeeId]



as

begin
select empid,Cardno,Empname from Mst_Employee where [Active]=1 

end


GO
/****** Object:  StoredProcedure [dbo].[Select_AllEmployeeId1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_AllEmployeeId1]

as

begin
select empid,Cardno,Empname from Mst_Employee where [Active]=1  
end


GO
/****** Object:  StoredProcedure [dbo].[Select_BreakReport_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  Proc [dbo].[Select_BreakReport_Print]    
                  
(                  
@FDate DateTime,                  
@ToDate DateTime                  
)                  
as                  
begin                  
                  
select e.EmpId,EmpName,EmpCode,CardNo,d.Dept_Name,Convert(Nchar(10),DateOffice,101) as DateOffice,                  
convert(Nchar(5),Break1in,108) as Break1in,convert(Nchar(5),Break1Out,108) as Break1Out,                  
CONVERT(Nchar(5),Break2IN,108) as Break2In,CONVERT(Nchar(5),Break2Out,108) as Break2Out,                  
convert(Nchar(5),Break1Out-Break1in,108) as Dur1,                  
CONVERT(Nchar(5),Break2Out-Break2IN,108) as Dur2,'Ststus' as Status ,'Remark' as Remark,                  
b.ShiftCode  as Temp1,b1.Branch_Name as Temp2,'Temp3' as Temp3,'Talwalkars Gym' as Temp4, convert(Nchar(10),@FDate,103) as FDate,                  
convert(Nchar(10),@ToDate,103) as  'ToDate'                  
                  
 from BreakDetails B,Mst_Employee E,Mst_Branch b1 ,Temp_EmpId T ,                  
Mst_Department d where b.empid=e.EmpId  and                    
e.DeptId=d.DeptId and e.BranchId=b1.BranchId  And e.EmpId=t.EmpId and                   
convert(Nchar(10),DateOffice,112) between @FDate and  @ToDate          
                
order BY  e.EmpId  ,  convert(Nchar(10),DateOffice,112)            
 End


GO
/****** Object:  StoredProcedure [dbo].[Select_BreakSummaryReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_BreakSummaryReport]  
@frdt smalldatetime,
@trdt smalldatetime,
 @Machineno int
as

Begin
Drop Table Dbo.BreakTable
select e.Empcode,e.Empname,convert(Nchar(5),punchDateTime,108) as T1,convert(Nchar(10),punchDateTime,103) 
As OfficeDate ,
(select  count(cardno) from  Tran_MachineRawPunch where cardno=t.cardno  and machineno=@Machineno  
and  convert(Nchar(10),punchDateTime,103)=convert(Nchar(10),t.punchDateTime,103)  GROUP BY cardno ) as TotalEMp

  into Dbo.BreakTable from  
Tran_MachineRawPunch t,mst_Employee E where  t.cardno=e.cardno and t.machineno=@Machineno
  and convert(Nchar(10),punchdatetime,101)   between @frdt and  @frdt 

order by e.Empcode,PunchDateTime
drop Table Dbo.BreakTable1
select  Distinct * into Dbo.BreakTable1  from BreakTable

exec [dbo].[BreakSummaryPrint]

end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyAbsetismReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_DailyAbsetismReport]

@fordate smalldatetime

as

begin
SELECT     me.EmpCode AS PayCode, me.CardNo, me.EmpName AS [EmployeeName],Ta.SHIFTATTENDED AS Shift,Right(CONVERT(NVARCHAR(5),Ta.SHIFTSTARTTIME,108),7) AS [ShiftStartTime], 
                       Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7) AS [InTime], Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],Right(CONVERT(NVARCHAR(20),Ta.OUT2,100),7)  AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks], 
                      Ta.STATUS AS Status, dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival], dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival], dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], 
                      dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
                      Ta.IN1MANNUAL + ',' + Ta.IN2MANNUAL + ',' + Ta.OUT1MANNUAL + ',' + Ta.OUT2MANNUAL AS Manual, dbo.Mst_Department.Dept_Name  as Department, convert(Nvarchar,ta.dateoffice,103) as PerformanceDate
					  ,Ta.LEAVECODE as leave,remark,'' onduty,(Select  CompanyName from  Dbo.Mst_Company Where CompanyId=me.CompanyId) as BreakTime,
dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, (Select  Branch_Name  from  Dbo.Mst_Branch Where BranchId=me.BranchId) as LUNCHEARLYDEPARTURE
FROM  Tran_Attendance AS Ta ,dbo.Mst_Employee AS me, dbo.Mst_Department,Temp_EmpId e
 where  me.EmpId = Ta.EmpId  and me.DeptId = dbo.Mst_Department.DeptId and Ta.EmpId = e.EmpId and Ta.status='A'
 and convert(Nvarchar(8),ta.dateoffice,112)=convert(Nvarchar(8),@fordate,112)

end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyAbsetismReport1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_DailyAbsetismReport1]

@fordate smalldatetime

as

begin
SELECT     me.EmpCode AS PayCode, me.CardNo, me.EmpName AS [EmployeeName],Ta.SHIFTATTENDED AS Shift,Right(CONVERT(NVARCHAR(5),Ta.SHIFTSTARTTIME,108),7) AS [ShiftStartTime], 
                       Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7) AS [InTime], Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],Right(CONVERT(NVARCHAR(20),Ta.OUT2,100),7)  AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks], 
                      Ta.STATUS AS Status, dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival], dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival], dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], 
                      dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
                      Ta.IN1MANNUAL + ',' + Ta.IN2MANNUAL + ',' + Ta.OUT1MANNUAL + ',' + Ta.OUT2MANNUAL AS Manual, dbo.Mst_Department.Dept_Name  as Department, convert(Nvarchar,ta.dateoffice,103) as PerformanceDate
					  ,Ta.LEAVECODE as leave,remark,'' onduty,(Select  CompanyName from  Dbo.Mst_Company Where CompanyId=me.CompanyId) as BreakTime,
dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, (Select  Branch_Name  from  Dbo.Mst_Branch Where BranchId=me.BranchId) as LUNCHEARLYDEPARTURE
FROM  Tran_Attendance AS Ta ,dbo.Mst_Employee AS me, dbo.Mst_Department,Temp_EmpId e
 where  me.EmpId = Ta.EmpId  and me.DeptId = dbo.Mst_Department.DeptId and Ta.EmpId = e.EmpId and Ta.presentvalue>0
 and convert(Nvarchar(8),ta.dateoffice,112)=convert(Nvarchar(8),@fordate,112)

end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyDeptSummaryReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_DailyDeptSummaryReport]

@fordate smalldatetime

as

select b.Dept_Name,count(a.rowid) as totemp,sum(presentvalue) as TotPresent,sum(absentvalue) as totabsent,
sum(leavevalue) as totleave, sum(wo_value) as totweekoff,convert( Nvarchar,a.dateoffice,103) as PerformanceDate
from dbo.tran_attendance a,Mst_Department b,mst_employee c,Temp_EmpId e
where a.empid =c.empid and b.deptid =c.deptid and a.EmpId = e.EmpId
and convert(Nvarchar(8),a.dateoffice,112)=convert(Nvarchar(8),@fordate,112)
group by b.Dept_Name,a.dateoffice


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyEarlyDeparture]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_DailyEarlyDeparture]   
  
@fordate smalldatetime  
  
as  
  
begin  
SELECT     me.EmpCode AS PayCode, me.CardNo, me.EmpName AS [EmployeeName],Ta.SHIFTATTENDED AS Shift,Right(CONVERT(NVARCHAR(5),Ta.SHIFTSTARTTIME,108),7) AS [ShiftStartTime],   
                      Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7) AS [InTime], Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn], Right(CONVERT(NVARCHAR(20),Ta.OUT2,108),8) AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],   
                      Ta.STATUS AS Status, dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival], dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival], dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture],   
                      dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLuncHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay],   
                      Ta.IN1MANNUAL + ',' + Ta.IN2MANNUAL + ',' + Ta.OUT1MANNUAL + ',' + Ta.OUT2MANNUAL AS Manual, dbo.Mst_Department.Dept_Name  as Department, convert(Nvarchar,ta.dateoffice,103) as PerformanceDate,  
       Ta.LEAVECODE as Leave , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,(Select  CompanyName from  Dbo.Mst_Company Where CompanyId=me.CompanyId) as BreakTime,  
     dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, (Select  Branch_Name  from  Dbo.Mst_Branch Where BranchId=me.BranchId) as LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL,  
     ta.earlyarrival,ta.earlydeparture,ta.latearrival,convert(Nvarchar(5),ta.ShiftEndTime,108) [ShiftEndTime],ta.Remark,ta.LEAVEVALUE,ta.PRESENTVALUE,ta.ABSENTVALUE,ta.HOLIDAY_VALUE,ta.WO_VALUE,Ta.OTDURATION,ta.HOURSWORKED  
  
 FROM dbo.Tran_Attendance AS Ta ,dbo.Mst_Employee AS me, dbo.Mst_Department,Temp_EmpId e  
 where  me.EmpId = Ta.EmpId  and me.DeptId = dbo.Mst_Department.DeptId and Ta.EmpId = e.EmpId and Ta.EARLYDEPARTURE<>00.00  
 and convert(Nvarchar(8),ta.dateoffice,112)=convert(Nvarchar(8),@fordate,112)  
  
  
   
end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyLateArrival]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_DailyLateArrival] 

@fordate smalldatetime

as

begin
SELECT     me.EmpCode AS PayCode, me.CardNo, me.EmpName AS [EmployeeName],Ta.SHIFTATTENDED AS Shift,Right(CONVERT(NVARCHAR(5),Ta.SHIFTSTARTTIME,108),7) AS [ShiftStartTime], 
                      Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7) AS [InTime], Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn], Right(CONVERT(NVARCHAR(5),Ta.OUT2,108),7) AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks], 
                      Ta.STATUS AS Status, dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival], dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival], dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], 
                      dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLuncHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
                      Ta.IN1MANNUAL + ',' + Ta.IN2MANNUAL + ',' + Ta.OUT1MANNUAL + ',' + Ta.OUT2MANNUAL AS Manual, dbo.Mst_Department.Dept_Name  as Department, convert(Nvarchar,ta.dateoffice,103) as PerformanceDate,
					  Ta.LEAVECODE as Leave , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,
					dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL,
					ta.earlyarrival,ta.earlydeparture,ta.latearrival,ta.ShiftEndTime [ShiftEndTime],ta.Remark,ta.LEAVEVALUE,ta.PRESENTVALUE,ta.ABSENTVALUE,ta.HOLIDAY_VALUE,ta.WO_VALUE,Ta.OTDURATION,ta.HOURSWORKED

 FROM dbo.Tran_Attendance AS Ta ,dbo.Mst_Employee AS me, dbo.Mst_Department,Temp_EmpId e
 where  me.EmpId = Ta.EmpId  and me.DeptId = dbo.Mst_Department.DeptId and Ta.EmpId = e.EmpId and Ta.LATEARRIVAL<>00.00
 and convert(Nvarchar(8),ta.dateoffice,112)=convert(Nvarchar(8),@fordate,112)


 
end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyMAchinePunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_DailyMAchinePunch]   
@fordate smalldatetime,  
@todate smalldatetime 
as


begin


Truncate table   TempMachinePunch
Drop table ss
 
 Select ta.Tran_MachineRawPunchId,b.EmpName,b.CardNo,convert(Nvarchar,ta.punchdatetime,103) as [PunchDate],convert(Nvarchar(5),ta.punchdatetime,108) as [PunchTime],ta.P_Day,b.EmpCode as Paycode,ta.MachineNo,ta.isManual 
 into ss From  Tran_MachineRawPunch ta ,Mst_Employee b where ta.isManual='N' and b.empid in(select empid from Temp_EmpId) and b.cardno=ta.cardno   and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112) 
 Order By  cardno



exec TempMachinePunchPrint



end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyManualPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_DailyManualPunch]
@fordate smalldatetime,
@todate smalldatetime = @fordate
as
begin
Select ta.Tran_MachineRawPunchId,b.EmpName,b.CardNo,convert(Nvarchar,ta.punchdatetime,103) as [PunchDate],ta.P_Day,b.EmpCode as Paycode,ta.MachineNo,ta.isManual 
 From Tran_MachineRawPunch ta ,Mst_Employee b where ta.isManual='y' and b.empid in(select empid from Temp_EmpId) and b.cardno=ta.cardno   and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112) 
 Order By  ta.punchdatetime
end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyManuualPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_DailyManuualPunch]  
 @fordate smalldatetime, 
@todate smalldatetime 
as


begin


Truncate table   TempMachinePunch
Drop table ss
 
 Select ta.Tran_MachineRawPunchId,b.EmpName,b.CardNo,convert(Nvarchar,ta.punchdatetime,103) as [PunchDate],convert(Nvarchar(5),ta.punchdatetime,108) as [PunchTime],ta.P_Day,b.EmpCode as Paycode,ta.MachineNo,ta.isManual 
 into ss From  Tran_MachineRawPunch ta ,Mst_Employee b where ta.isManual='Y' and b.empid in(select empid from Temp_EmpId) and b.cardno=ta.cardno   and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112) 
 Order By  cardno



exec TempMachinePunchPrint



end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyMissPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_DailyMissPunch]   
@fordate smalldatetime 
as



begin
IF OBJECT_ID('[misspunch','U') IS  NULL 
	begin
		DROP TABLE dbo.[misspunch]
	end


 select t.cardno, convert(Nvarchar,punchdatetime,101) as PunchDate,(select case when (count(t1.PunchDateTime) %  2)=1 then '*' else ' ' END AS 'Mispunch' 
 from Tran_MachineRawPunch t1 where t1.cardno=t.cardno and convert(Nvarchar,punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@fordate,112)) as Mispunch  into dbo.misspunch from Tran_MachineRawPunch t,mst_employee b where b.cardno=t.cardno and  convert(Nvarchar,punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@fordate,112) and ismanual='N' group by t.cardno,punchDatetime



exec Select_DailyMissPunchPrint
end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyMissPunchPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE  [dbo].[Select_DailyMissPunchPrint]
as 
select e.Cardno,e.punchDate,e.Mispunch,b.empname,d.Dept_Name from misspunch e,mst_Employee b ,mst_department d   where b.cardno=e.cardno and d.deptid=b.deptid   and b.empid in(select empid from Temp_EmpId) and  mispunch='*'


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyOTSummary]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_DailyOTSummary]
@fordate smalldatetime
as
begin
SELECT dbo.convertTime(sum(a.OTDURATION)) AS [OT Duration], sum(a.OTAMOUNT) AS [OT Amount], dbo.convertTime(sum(a.OSDURATION)) AS [Over Stay], 
B.Dept_Name  as Department, convert(Nvarchar,a.dateoffice,103) as PerformanceDate,sum(a.OTDURATION) as computeOT

from dbo.tran_attendance a,Mst_Department b,mst_employee c,Temp_EmpId e
where a.empid =c.empid and b.deptid =c.deptid and a.EmpId = e.EmpId
and convert(Nvarchar(8),a.dateoffice,112)=convert(Nvarchar(8),@fordate,112)
group by b.Dept_Name ,a.dateoffice

 
 
 
end


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyPerformanceReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_DailyPerformanceReport]   
@fordate smalldatetime

as

begin
SELECT     me.EmpCode AS PayCode, me.CardNo, me.EmpName AS [EmployeeName],Ta.SHIFTATTENDED AS Shift,Right(CONVERT(NVARCHAR(5),Ta.SHIFTSTARTTIME,108),7)  AS [ShiftStartTime], 
            Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7) AS [InTime], Ta.OUT1 AS [LunchOut],convert(Nchar(5), Ta.IN2,108) AS [LunchIn],Right(CONVERT(NVARCHAR(7),Ta.OUT2,108),7)   AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks], 
                      Ta.STATUS AS Status, dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival], dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival], dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], 
                      dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLuncHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
                      Ta.IN1MANNUAL + ',' + Ta.IN2MANNUAL + ',' + Ta.OUT1MANNUAL + ',' + Ta.OUT2MANNUAL AS Manual, dbo.Mst_Department.Dept_Name  as Department, convert(Nvarchar,ta.dateoffice,103) as PerformanceDate,
					  Ta.LEAVECODE as Leave , Ta.TOTALLOSSHRS,convert(Nchar(5),out1,108) as AccessLunch,(Select  CompanyName from  Dbo.Mst_Company Where CompanyId=me.CompanyId) as BreakTime,
					dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, (Select  Branch_Name  from  Dbo.Mst_Branch Where BranchId=me.BranchId) as LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL,
					ta.earlyarrival,ta.earlydeparture,ta.latearrival,ta.ShiftEndTime [ShiftEndTime],ta.Remark,ta.LEAVEVALUE,ta.PRESENTVALUE,ta.ABSENTVALUE,ta.HOLIDAY_VALUE,ta.WO_VALUE,Ta.OTDURATION,ta.HOURSWORKED

 FROM dbo.Tran_Attendance AS Ta ,dbo.Mst_Employee AS me, dbo.Mst_Department,Temp_EmpId e
 where  me.EmpId = Ta.EmpId  and me.DeptId = dbo.Mst_Department.DeptId and Ta.EmpId = e.EmpId
 and convert(Nvarchar(8),ta.dateoffice,112)=convert(Nvarchar(8),@fordate,112)

ENd


GO
/****** Object:  StoredProcedure [dbo].[Select_DailyPunchingReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_DailyPunchingReport]   
@fordate smalldatetime

as

begin
SELECT     me.EmpCode AS PayCode, me.CardNo, me.EmpName AS [EmployeeName],Ta.SHIFTATTENDED AS Shift,Right(CONVERT(NVARCHAR(5),Ta.SHIFTSTARTTIME,108),7)  AS [ShiftStartTime], 
            Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7) AS [InTime], Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],Right(CONVERT(NVARCHAR(7),Ta.OUT2,108),7)   AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks], 
                      Ta.STATUS AS Status, dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival], dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival], dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], 
                      dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLuncHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
                      Ta.IN1MANNUAL + ',' + Ta.IN2MANNUAL + ',' + Ta.OUT1MANNUAL + ',' + Ta.OUT2MANNUAL AS Manual, dbo.Mst_Department.Dept_Name  as Department, convert(Nvarchar,ta.dateoffice,103) as PerformanceDate,
					  Ta.LEAVECODE as Leave , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,(Select  CompanyName from  Dbo.Mst_Company Where CompanyId=me.CompanyId) as CompanyName,
					dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, (Select  Branch_Name  from  Dbo.Mst_Branch Where BranchId=me.BranchId) as Branch_Name, Ta.LUNCHLATEARRIVAL,
					ta.earlyarrival,ta.earlydeparture,ta.latearrival,ta.ShiftEndTime [ShiftEndTime],ta.Remark,ta.LEAVEVALUE,ta.PRESENTVALUE,ta.ABSENTVALUE,ta.HOLIDAY_VALUE,ta.WO_VALUE,Ta.OTDURATION,ta.HOURSWORKED,
des.Desig_name,Right(CONVERT(NVARCHAR(5),Ta.punch1,108),7)    as temp1,Right(CONVERT(NVARCHAR(5),Ta.punch2,108),7)    as temp2,
Right(CONVERT(NVARCHAR(5),Ta.punch3,108),7)    as temp3,Right(CONVERT(NVARCHAR(5),Ta.punch4,108),7)    as temp4,'temp1' as temp5

 FROM dbo.Tran_Attendance AS Ta ,dbo.Mst_Employee AS me, dbo.Mst_Department,dbo.Mst_Designation des,dbo.Temp_EmpId e
 where  me.EmpId = Ta.EmpId  and me.DeptId = dbo.Mst_Department.DeptId and Ta.EmpId = e.EmpId and des.desigid=me.desigid
 and convert(Nvarchar(8),ta.dateoffice,112)=convert(Nvarchar(8),@fordate,112)

ENd


GO
/****** Object:  StoredProcedure [dbo].[Select_Emp_ValidatePassword]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Emp_ValidatePassword] 
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Feb 04 2012
	   Modify Date	: Feb 04 2012 
	   Notes	: Select_Mst_User
*/

          @Empcode Nvarchar(10),
          @Password Nvarchar(50)

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [Empid] FROM [mst_Employee]  WHERE   [EmpCode] = @Empcode And [Pwd] = @Password  
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_EmployeeId]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create  procedure [dbo].[Select_EmployeeId]

@empcode Nvarchar(10)

as

begin
select empid from Mst_Employee  where empcode=@empcode and  [Active]=1 

end


GO
/****** Object:  StoredProcedure [dbo].[Select_ExecSummaryReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_ExecSummaryReport]
@frdt smalldatetime,
@trdt smalldatetime,
@wstaff Nchar(1)
as

select b.empcode,b.empname,sum(presentvalue) as Present,
ISNULL((select sum(leavevalue) from tran_attendance where empid=a.empid and leavecode='PL' AND dateoffice between @frdt and @trdt),0) AS PL,
ISNULL((select sum(leavevalue) from tran_attendance where empid=a.empid and leavecode='SL' AND dateoffice between @frdt and @trdt),0) AS SL,
ISNULL((select sum(leavevalue) from tran_attendance where empid=a.empid and leavecode='CL' AND dateoffice between @frdt and @trdt),0) AS CL,
sum(absentvalue) as Absent,
ISNULL((select count(status) from tran_attendance where empid=a.empid and status='WO' and dbo.DayOfWeek(dateoffice) ='Saturday' AND dateoffice between @frdt and @trdt),0) AS satoff,
ISNULL((select count(status) from tran_attendance where empid=a.empid and status='WO' and dbo.DayOfWeek(dateoffice) ='Sunday' AND dateoffice between @frdt and @trdt),0) AS sundayoff,
ISNULL((select count(empid) from tran_attendance where empid=a.empid and latearrival>0 and  latearrival<60 AND dateoffice between @frdt and @trdt),0) AS late1,
ISNULL((select count(empid) from tran_attendance where empid=a.empid and latearrival=0 and  hoursworked>=495
and (convert(Nvarchar(5),in1,108) between '09:45' and '10:30')  AND (dateoffice between @frdt and @trdt)),0) AS late2,
ISNULL((select count(empid) from tran_attendance where empid=a.empid and convert(Nvarchar(5),in1,108) >'11:30'  AND (dateoffice between @frdt and @trdt)),0) AS After1130,
ISNULL((select count(empid) from tran_attendance where empid=a.empid and earlydeparture>0 AND dateoffice between @frdt and @trdt),0) AS EarlyGo,
ISNULL((select count(status) from tran_attendance where empid=a.empid and status='HD'  AND dateoffice between @frdt and @trdt),0) AS HOLIDAY,0 AS OPholiday,
dbo.ConvertTime(sum(otduration)) as OtHours,a.empid
From tran_attendance a, Mst_Employee b,Temp_EmpId c
where   a.empid=c.empid and  a.empid=b.empid and b.otimepoliceid =@wstaff and  dateoffice between @frdt and @trdt
group by a.empid,b.empcode,b.empname


GO
/****** Object:  StoredProcedure [dbo].[Select_GetQuery]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_GetQuery]
/*
 	   Create by	: Raj kumar
	   Create Date	: Dec 16 2010
	   Modify Date	: Dec 16 2010 
	   Notes	: Select_Tran_MachineRawPunch
*/

          @GetQry nvarchar(max)

AS
BEGIN
DECLARE @SQL nvarchar(max)
SET @SQL = @GetQry
EXEC(@SQL)
END


GO
/****** Object:  StoredProcedure [dbo].[Select_IIWOtypeList]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[Select_IIWOtypeList]
as

Begin

select 1 as IIWOTypeId,'None' as IIWOTypeName
union all
select 2 as IIWOTypeId,'Half' as IIWOTypeName
union all
select 3 as IIWOTypeId,'Full' as IIWOTypeName order by IIWOTypeId


end


GO
/****** Object:  StoredProcedure [dbo].[Select_latearrival]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_latearrival] 
  
@fordate smalldatetime,  
@ToDate smallDatetime

as

begin
SELECT     me.EmpCode AS PayCode,me.Empname, dept.Dept_name, ta.presentvalue,Ta.OTDuration as OverTime, ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as 
Hours_Worked,Holiday_Value as Holiday, Wo_Value as WO,Right(CONVERT(NVARCHAR(20),Ta.SHIFTSTARTTIME,100),7) AS [ShiftStartTime], 
          convert(Nchar(5), Ta.IN1,108) AS [InTime], Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,
           Ta.STATUS AS Status,  dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],
           dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],ta.otduration as [cotduration],Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],
		   dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
          ta.dateoffice  as PerformanceDate, Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,
		   dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL
		   ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,(select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,isnull(Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7),'') AS [InTime1] ,
       Ta.OUT2 AS OutTime1,Branch_Name ,c.CompanyNAme,c.address as CompanyAddress,
convert(Nchar(10),@fordate,103) as temp1,convert(Nchar(10),@ToDate,103) as temp2,'t1' as temp3,'t1' as temp4,'t1' as temp5,'t1' as temp6 
			
	FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e, Mst_Branch as  b,Mst_Company as c
	WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid
	 and  convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112)  

And  me.Branchid=b.branchID And me.CompanyId=c.CompanyID
 	order By me.empid,ta.dateoffice  


end










set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON


GO
/****** Object:  StoredProcedure [dbo].[Select_LeaveApplication]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_LeaveApplication]   
  
  
          @Empid numeric(18,0)  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
SELECT Leave.RwId,emp.EmailAddress,CONVERT(Nvarchar(10), FromDate,103) as fromDate, Reason,Remark, CONVERT(Nvarchar(10), ToDate,103)   
as ToDate,Leave.Leaveid,Dur1,Dur2,Dur3,Dur4,ApprovedStatus,emp.empcode,Emp.Empname,emp.FatherName,com.CompanyName,desig.Desig_Name,  
emp.companyid,emp.CardNo,Dept.Dept_name ,leavetype.LTypeName,Leave.ApplicationDate FROM mst_LeaveApplication Leave ,  
mst_Employee emp,Mst_LeaveType leavetype,mst_department Dept,Mst_Company com ,Mst_Designation desig  WHERE Leave.empid=emp.empid and   
 emp.deptid=dept.deptid and Leave.leaveid=leavetype.leaveTypeid and com.Companyid=emp.companyid and desig.desigId=emp.desigId and rwid =@Empid  
    
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_LeaveByParentId]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[Select_LeaveByParentId]     
  @Parentid int    
AS    
    
  SET NOCOUNT ON    
  BEGIN     
    
select Rwid,e.EmpName,l.Fromdate,convert(Nchar(10),l.ApplicationDate,103) as ApplicationDate ,l.ApprovedStatus,    
(select Dept_name  from  Mst_Department where Mst_Department.deptid=e.deptid)as Dept_name,    
l.Todate,l.Reason,c.LTypeName,l.Dur1,l.Dur2,l.Dur3,l.Dur4,l.ApprovedStatus,l.ApprovedBy     
 from  Mst_LeaveApplication l,mst_Employee e ,Mst_LeaveType c where l.Empid=e.empid  and c.LeaveTypeiD=l.leaveid and  l.ApprovedBy=@Parentid  order BY ApplicationDate  desc 
END    
  SET NOCOUNT OFF    
    
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_LeaveDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Select_LeaveDetail]

@frdt smalldatetime,
@trdt smalldatetime

as 
begin

select empcode,empname,convert(Nchar(10),dateofjoin,103) as dtjoin,dept_name,desig_name,
    convert(Nchar(10),fromdate,103) fromdate,convert(Nchar(10),todate,103) todate,d.ltypecode as leavename,datediff(d,fromdate,todate)+1 as LeaveDays,reason
	from mst_employee a,mst_department b,mst_designation c,mst_LeaveType d,Temp_EmpId e,mst_leaveapplication f
	where a.deptid=b.deptid and a.desigid=c.desigid and a.empid=e.empid and a.empid=f.empid
    and f.leaveid=d.leavetypeid and approvedstatus='Approved'
    and ( fromdate between @frdt and @trdt or todate between @frdt and @trdt)
end


GO
/****** Object:  StoredProcedure [dbo].[Select_LeaveTransaction]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  Proc [dbo].[Select_LeaveTransaction]       
(@FDate Nvarchar(10),@TDate Nvarchar(10))    
as    
Begin    
    
Select Convert(Nchar(10),T.dateOffice,103) as DateOffice, E.Empcode as DeptId,E.EmpName,D.Dept_Name,L.LTypeCode,l.LTypeName,    
C.CompanyName,B.Branch_Name    
    
 from Tran_Attendance T,Mst_Employee E,Mst_LeaveType L,Mst_Department D,Mst_Company C,Mst_Branch B,Temp_EmpId T1    
    
WHere T.EmpId=E.EmpId and T.STATUS=l.LTypeCode  ANd E.DeptId=D.DeptId and     
C.companyId=E.CompanyId and b.BranchId=E.BranchId  and T.EmpId=T1.EmpId  and Convert(Nchar(10),T.dateOffice,103)    
    
Between  @FDate and  @TDate    
    
End


GO
/****** Object:  StoredProcedure [dbo].[Select_MachinerawData]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_MachinerawData]
@fordate smalldatetime,
@todate smalldatetime = @fordate
as
begin
select e.empcode,e.empname,e.cardno,convert(Nvarchar,ta.punchdatetime,103) as [Punch Date],convert(Nvarchar(5),ta.punchdatetime,108) as [PunchTimeRemarks],
 convert(Nvarchar(5),ta.punchdatetime,108) as [Punch Time]  ,max(@fordate) as [Fordate],max(@todate) as [Todate]
from mst_employee e,tran_machinerawpunch ta,Temp_empid te  where  e.cardno=ta.cardno and e.empid=te.empid and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112)  and convert(Nvarchar,@todate,112) 
group by e.empcode,e.empname,e.cardno,ta.punchdatetime,ta.isManual order by e.empcode,ta.punchdatetime
end


GO
/****** Object:  StoredProcedure [dbo].[Select_MachineRawPunchPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_MachineRawPunchPrint]
@fordate smalldatetime,
@todate smalldatetime = @fordate
as
begin
Select ta.Tran_MachineRawPunchId,b.EmpName,b.CardNo,convert(Nvarchar,ta.punchdatetime,103) as [PunchDate],ta.P_Day,  ta.isManual,b.EmpCode as Paycode,ta.MachineNo
 From Tran_MachineRawPunch ta ,Mst_Employee b where ta.isManual='N' and b.empid in(select empid from Temp_EmpId) and  b.cardno=ta.cardno  and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112) 
 Order By  ta.punchdatetime
end


GO
/****** Object:  StoredProcedure [dbo].[Select_ManualPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_ManualPunch]
@fordate smalldatetime,
@todate smalldatetime = @fordate
as
begin
select e.empcode,e.empname,e.cardno,convert(Nvarchar,ta.punchdatetime,103) as [Punch Date],convert(Nvarchar(5),ta.punchdatetime,108) as [PunchTimeRemarks],
'Punch Time'=case  when ta.isManual='y' then convert(Nvarchar(5),ta.punchdatetime,108)+' M'
else  convert(Nvarchar(5),ta.punchdatetime,108) end ,max(@fordate) as [Fordate],max(@todate) as [Todate]
from mst_employee e,tran_machinerawpunch ta,Temp_empid te  where  e.cardno=ta.cardno and e.empid=te.empid and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112)  and convert(Nvarchar,@todate,112) 
group by e.empcode,e.empname,e.cardno,ta.punchdatetime,ta.isManual order by e.empcode,ta.punchdatetime
end


GO
/****** Object:  StoredProcedure [dbo].[Select_ManualPunchPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_ManualPunchPrint]
@fordate smalldatetime,
@todate smalldatetime = @fordate
as
begin
Select ta.Tran_MachineRawPunchId,b.EmpName,b.CardNo,convert(Nvarchar,ta.punchdatetime,103) as [PunchDate],ta.P_Day,b.EmpCode as Paycode,ta.MachineNo,ta.isManual 
 From Tran_MachineRawPunch ta ,Mst_Employee b where ta.isManual='y' and b.empid in(select empid from Temp_EmpId) and b.cardno=ta.cardno   and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112) 
 Order By  ta.punchdatetime
end


GO
/****** Object:  StoredProcedure [dbo].[Select_Monthly_MAchinePunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[Select_Monthly_MAchinePunch]       
@fordate smalldatetime,      
@todate smalldatetime     
as    
    
    
begin    
    
    
Truncate table   TempMachinePunch    
Drop table Dbo.ss    
     
 Select ta.Tran_MachineRawPunchId,b.EmpName,b.CardNo,convert(Nvarchar,ta.punchdatetime,103) as [PunchDate],convert(Nvarchar(5),ta.punchdatetime,108) as [PunchTime],ta.P_Day,b.EmpCode as Paycode,ta.MachineNo,ta.isManual     
 into Dbo.ss From  Tran_MachineRawPunch ta ,Mst_Employee b where ta.isManual='N' and b.empid in(select empid from Temp_EmpId) and b.cardno=ta.cardno   and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,  
 @todate,112)     
 Order By  cardno    
    
   
  exec TempMachinePunchPrint1    
    
    
end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyAbsentReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlyAbsentReport]    
  
@fordate smalldatetime,  
@ToDate smallDatetime

as

begin
SELECT     me.EmpCode AS PayCode,me.Empname, dept.Dept_name, ta.presentvalue,Ta.OTDuration as OverTime, ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as 
Hours_Worked,Holiday_Value as Holiday, Wo_Value as WO,Right(CONVERT(NVARCHAR(20),Ta.SHIFTSTARTTIME,100),7) AS [ShiftStartTime], 
           Ta.IN1 AS [InTime], Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,
           Ta.STATUS AS Status,  dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],
           dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],ta.otduration as [cotduration],Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],
		   dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
          ta.dateoffice  as PerformanceDate, Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,
		   dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL
		   ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,(select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,isnull(Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7),'') AS [InTime1] ,
       Ta.OUT2 AS OutTime1,Branch_Name ,c.CompanyNAme,c.address as CompanyAddress,
convert(Nchar(10),@fordate,103) as temp1,convert(Nchar(10),@ToDate,103) as temp2,'t1' as temp3,'t1' as temp4,'t1' as temp5,'t1' as temp6 
			
	FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e, Mst_Branch as  b,Mst_Company as c
	WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid
	 and  convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112)  

And  me.Branchid=b.branchID And me.CompanyId=c.CompanyID And ta.absentvalue>0  and ta.WO_VALUE<1
 	order By me.empid,ta.dateoffice  


end


GO
/****** Object:  StoredProcedure [dbo].[Select_monthlyBreakSummaryReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_monthlyBreakSummaryReport]   
 
@frdt smalldatetime,
@trdt smalldatetime

as

Begin
Drop Table MonthlySummaryTable
select Distinct  E.Empcode,E.Empname,convert(Nchar(10),t.DateOffice,103) as DateOffice,convert(Nchar(5),Tea1Out,108) as Tea1Out,
convert(Nchar(5),Tea1In,108)as Tea1In, Tea1Min,Tea2Out,Tea2in,Tea2min,convert(Nchar(5),LunchOut,108) as LunchOut, convert(Nchar(5),Lunchin,108) as Lunchin,LunchMin,
convert(Nchar(6),Od1Out,108) as Od1Out, convert(Nchar(5),OD1In,108) as OD1In,Od1Min,
(Select Sum(Tea1Min)+isnull(Sum(Tea2Min),0) from Tran_TeaLunchBreaks where empid=t.empid and convert(Nchar(10),t.DateOffice,101)   between @frdt and  @trdt ) as 'TotalTeaDur',
(Select Sum(LunchMin) from Tran_TeaLunchBreaks where empid=t.empid and convert(Nchar(10),t.DateOffice,101)   between @frdt and  @trdt) as 'TotallunchDur',
(Select Sum(OD1Min) from Tran_TeaLunchBreaks where empid=t.empid and convert(Nchar(10),t.DateOffice,101)   between @frdt and  @trdt ) as 'TotalODDur'
into Dbo.MonthlySummaryTable from Tran_TeaLunchBreaks t,mst_EMployee E,Temp_EmpId a  where e.empid=a.empid and  t.empid=e.empid and 
   convert(Nchar(10),t.DateOffice,101)   between @frdt and  @trdt
 


ALTER TABLE MonthlySummaryTable ADD EmployeeID int identity(1,1) PRIMARY KEY;

WHILE EXISTS (SELECT COUNT(*) FROM MonthlySummaryTable GROUP BY Empcode, DateOffice HAVING COUNT(*) > 1)
BEGIN
    DELETE FROM MonthlySummaryTable WHERE EmployeeID IN 
    (
        SELECT MIN(EmployeeID) as [DeleteID]
        FROM MonthlySummaryTable
        GROUP BY Empcode, DateOffice
        HAVING COUNT(*) > 1
    )
END

select Distinct  Empcode,Empname,DateOffice,Tea1Out,Tea1In,dbo.ConvertTime(Tea1min)  as Tea1min ,Tea2Out,Tea2in,dbo.ConvertTime(Tea2min) as Tea2min,LunchOut,
LunchIn,dbo.ConvertTime(Lunchmin) as Lunchmin ,Od1Out,Od1In,dbo.ConvertTime(Od1Min) as Od1Min  ,
isnull(dbo.ConvertTime(TotalTeaDur),0)  as TotalTeaDur,isnull(dbo.ConvertTime(TotallunchDur),0)  as TotallunchDur,
isnull(dbo.ConvertTime(TotalODDur),0)  as TotalODDur from  Dbo.MonthlySummaryTable   





end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyDeptSummaryReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_MonthlyDeptSummaryReport]

@fordate smalldatetime,
@todate smalldatetime

as

select b.dept_name,count(a.rowid) as totemp,sum(presentvalue) as TotPresent,sum(absentvalue) as totabsent,
sum(leavevalue) as totleave, sum(wo_value) as totweekoff,max(@fordate) as [Fordate],max(@todate) as  [Todate]
from dbo.tran_attendance a,Mst_Department b,mst_employee c,Temp_EmpId e
where a.empid =c.empid and b.DeptId =c.DeptId and a.EmpId = e.EmpId
and convert(Nvarchar(8),a.dateoffice,112) between convert(Nvarchar(8),@fordate,112)  and convert(Nvarchar(8),@todate,112)
group by b.dept_name


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyEarlydeparture]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlyEarlydeparture]   
  
@fordate smalldatetime,
@ToDate smallDatetime

as

begin
SELECT     me.EmpCode AS PayCode,me.Empname, dbo.Mst_Department.Dept_name, ta.presentvalue,Ta.OTDuration as OverTime, ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as 
Hours_Worked,Holiday_Value as Holiday, Wo_Value as WO,Ta.SHIFTSTARTTIME AS [ShiftStartTime], 
           Ta.IN1 AS [InTime], Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],
           Ta.STATUS AS Status,  dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],
           dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],ta.otduration as [cotduration],Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],
		   dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
          CONVERT(NVARCHAR(10),ta.dateoffice,101)  as PerformanceDate, Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,
		   dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL
		   ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent
			
FROM         dbo.Tran_Attendance AS Ta INNER JOIN
             dbo.Mst_Employee AS me ON Ta.EmpId = me.EmpId INNER JOIN
             dbo.Mst_Department ON me.DeptId = dbo.Mst_Department.DeptId join
			 Temp_EmpId as e on e.empid=ta.empid
 where convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112) and Ta.EARLYDEPARTURE<>00.00
end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyMachinePunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_MonthlyMachinePunch]
@fordate smalldatetime,
@todate smalldatetime 
as
begin
Select ta.Tran_MachineRawPunchId,b.EmpName,b.CardNo,convert(Nvarchar,ta.punchdatetime,103) as [PunchDate],ta.P_Day,  ta.isManual,b.EmpCode as Paycode,ta.MachineNo
 From Tran_MachineRawPunch ta ,Mst_Employee b where ta.isManual='N'  and b.empid in(select empid from Temp_EmpId) and  b.cardno=ta.cardno  and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112) 
 Order By  ta.punchdatetime
end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyManualPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_MonthlyManualPunch]
@fordate smalldatetime,
@todate smalldatetime 
as
begin
Select ta.Tran_MachineRawPunchId,b.EmpName,b.CardNo,convert(Nvarchar,ta.punchdatetime,103) as [PunchDate],ta.P_Day,b.EmpCode as Paycode,ta.MachineNo,ta.isManual 
 From Tran_MachineRawPunch ta ,Mst_Employee b where ta.isManual='y' and b.cardno=ta.cardno  and b.empid in(select empid from Temp_EmpId)  and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112) 
 Order By  ta.punchdatetime
end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyMissPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_MonthlyMissPunch] 
@fordate smalldatetime,
@todate smalldatetime 

as
begin

IF OBJECT_ID('dbo.[misspunch','U') IS  NULL 
DROP TABLE DBo.[misspunch]
select t.cardno, convert(Nvarchar,punchdatetime,101) as PunchDate,(select case when (count(t1.PunchDateTime) %  2)=1 then '*' else ' ' END AS "Mispunch" 
from Tran_MachineRawPunch t1 where t1.cardno=t.cardno and convert(Nvarchar,punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112))as 'Mispunch' into dbo.misspunch from Tran_MachineRawPunch t,mst_employee b where b.cardno=t.cardno and  convert(Nvarchar,punchdatetime,112)  between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@todate,112) and ismanual='N' group by t.cardno,punchDatetime




select e.Cardno,e.punchDate,e.Mispunch,b.empname,d.Dept_Name from dbo.misspunch e,mst_Employee b ,mst_department d   where b.cardno=e.cardno and d.deptid=b.deptid   and b.empid in(select empid from Temp_EmpId) and mispunch='*'

end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyOTSummary]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlyOTSummary] 
@fordate smalldatetime,
@toDate smalldatetime
as
begin
SELECT c.empname,c.empcode ,c.cardno,dbo.convertTime(sum(a.OTDURATION)) AS [OTDuration], sum(a.OTAMOUNT) AS [OTAmount], dbo.convertTime(sum(a.OSDURATION)) AS [OverStay], 
B.Dept_Name  as Department,sum(a.OTDURATION) as computeOT,convert(Nvarchar(10),max(@fordate),103)  as [Fordate],convert(Nvarchar(10),max(@todate),103) as  [Todate]
from dbo.tran_attendance a,Mst_Department b,mst_employee c,Temp_EmpId e
where a.empid =c.empid and b.deptid =c.deptid and a.EmpId = e.EmpId 
and convert(Nvarchar(8),a.dateoffice,112) between convert(Nvarchar(8),@fordate,112) and convert(Nvarchar(8),@todate,112)
group by b.Dept_Name ,a.dateoffice,c.empname,c.empcode ,c.cardno
having sum(a.OTDURATION) > 0 
 
end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyPerformanceReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlyPerformanceReport]
@fordate smalldatetime,
@ToDate smalldatetime
as
begin
	SELECT me.EmpCode AS PayCode, me.CardNo, me.EmpName AS [EmployeeName],sum(ta.presentvalue) as Present,sum(ta.absentvalue) as Absent,sum(Holiday_Value) as Holiday,sum(Wo_Value) as WO,sum(ta.leaveValue)as Leave,dbo.convertTime(sum(ta.HoursWorked)) as 
Hours_Worked,dbo.convertTime(sum(ta.OTDuration)) as OverTime,sum(ta.OtAmount) as [OTAmount],dbo.Mst_Department.Dept_Name  as Department
,sum(ta.LATEARRIVAL) as [CLateArrival],sum(ta.EarlyDeparture) as CEarlyDeparture,sum(ta.HoursWorked) as [cTotalHour],sum(ta.LEAVEVALUE) as Cleave ,sum(ta.ABSENTVALUE) as CAbsent ,SUM(ta.OTDuration) AS cOTDuration,max(@fordate) as [Fordate],max(@todate) as  [Todate]
FROM  dbo.Tran_Attendance AS Ta INNER JOIN
      dbo.Mst_Employee AS me ON Ta.EmpId = me.EmpId INNER JOIN      
      dbo.Mst_Department  ON me.DeptId = dbo.Mst_Department.DeptId
		join Temp_EmpId as  e on ta.empid=e.empid
where convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@ToDate,112) 
group by me.EmpCode,me.CardNo,me.EmpName,Mst_Department.Dept_Name  
end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyPerformanceReport_Wstaff]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlyPerformanceReport_Wstaff]
@fordate smalldatetime,
@ToDate smalldatetime,
@worker as Nchar(1)
as
 
begin
SELECT     me.EmpCode AS PayCode,me.Empname, dept.Dept_name, ta.presentvalue,Ta.OTDuration as OverTime, ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as 
Hours_Worked,Holiday_Value as Holiday, Wo_Value as WO,Right(CONVERT(NVARCHAR(20),Ta.SHIFTSTARTTIME,100),7) AS [ShiftStartTime], 
           Ta.IN1 AS [InTime], Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,
           Ta.STATUS AS Status,  dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],
           dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],ta.otduration as [cotduration],Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],
		   dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
          ta.dateoffice  as PerformanceDate, Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,
		   dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL
		   ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,(select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,isnull(Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7),'') AS [InTime1] ,
         isnull(Right(CONVERT(NVARCHAR(5),Ta.OUT2,108),7),'') AS OutTime1
			
	FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e
	WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid and me.otimepoliceid =@worker
	 and  convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112)   	order By me.empid,ta.dateoffice  




end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlyPersentReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlyPersentReport]   
  
@fordate smalldatetime,  
@ToDate smallDatetime

as

begin
SELECT     me.EmpCode AS PayCode,me.Empname, dept.Dept_name, ta.presentvalue,Ta.OTDuration as OverTime, ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as 
Hours_Worked,Holiday_Value as Holiday, Wo_Value as WO,Right(CONVERT(NVARCHAR(20),Ta.SHIFTSTARTTIME,100),7) AS [ShiftStartTime], 
           Ta.IN1 AS [InTime], Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,
           Ta.STATUS AS Status,  dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],
           dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],ta.otduration as [cotduration],Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],
		   dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
          ta.dateoffice  as PerformanceDate, Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,
		   dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL
		   ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,(select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,isnull(Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7),'') AS [InTime1] ,
       Ta.OUT2 AS OutTime1,Branch_Name ,c.CompanyNAme,c.address as CompanyAddress,
convert(Nchar(10),@fordate,103) as temp1,convert(Nchar(10),@ToDate,103) as temp2,'t1' as temp3,'t1' as temp4,'t1' as temp5,'t1' as temp6 
			
	FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e, Mst_Branch as  b,Mst_Company as c
	WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid
	 and  convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112)  

And  me.Branchid=b.branchID And me.CompanyId=c.CompanyID And ta.presentvalue>0.0
 	order By me.empid,ta.dateoffice  


end





set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySubPerformanceReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlySubPerformanceReport]       @fordate smalldatetime,   @ToDate smallDatetime  as  begin

SELECT me.EmpCode AS PayCode,me.Empname, dept.Dept_name, ta.presentvalue,Ta.OTDuration as OverTime,
 ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as  Hours_Worked,Holiday_Value as Holiday,  
 Wo_Value as WO,Right(CONVERT(NVARCHAR(20),Ta.SHIFTSTARTTIME,100),7) AS [ShiftStartTime],             Ta.IN1 AS [InTime],
 Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,            Ta.STATUS AS Status,  
 dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],            dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],
 ta.otduration as [cotduration],convert(Nchar(05),Ta.OUT1,108) AS [LunchOut],convert(Nchar(5), Ta.IN2,108) AS [LunchIn],
 dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],  dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],
 dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], 
 Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay],           ta.dateoffice as PerformanceDate, 
 Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,
 dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,      
 dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, 
 Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL      ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,
 (select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,isnull(Right(CONVERT(NVARCHAR(5),Ta.IN1,105),7),'') AS [InTime1] ,
 Ta.OUT2 AS OutTime1,Branch_Name ,c.CompanyNAme,c.address as CompanyAddress, convert(Nchar(10),@fordate,103) as temp1,convert(Nchar(10),@ToDate,103) as temp2,
 left(DATENAME(dw,dateoffice),3)  as temp3,me.DesigId as temp4,CONVERT(NVARCHAR(5),Ta.IN1,105) as temp5,'t1' as temp6     
 FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e, Mst_Branch as  b,Mst_Company as c 
WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid   and  convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112)    And  me.Branchid=b.branchID And me.CompanyId=c.CompanyID   order By me.empid,ta.dateoffice      
end  
set ANSI_NULLS ON  
set QUOTED_IDENTIFIER ON


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySubPerformanceReport_Smartime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlySubPerformanceReport_Smartime]               @fordate smalldatetime,   @ToDate smallDatetime  as  begin SELECT  me.EmpCode AS PayCode,me.Empname, dept.Dept_name,                ta.presentvalue,Ta.OTDuration as OverTime, ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as  Hours_Worked,                 Holiday_Value as Holiday, Wo_Value as WO,CONVERT(char(5), SHIFTSTARTTIME,108) AS [ShiftStartTime],             Ta.IN1 AS [InTime],                Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,            Ta.STATUS AS Status,                  dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],  dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],                 ta.otduration as [cotduration],           (+right('0'+CAST(((select DATEDIFF(MINUTE,CONVERT(char(5),         Break1in,108),CONVERT(char(5), Break1Out,108))) / 60)  AS VARCHAR(2)), 2) + ' : ' +RIGHT('0'+CAST(((select DATEDIFF(MINUTE,CONVERT(char(5),      Break1in,108),CONVERT(char(5), Break1Out,108))) % 60)  AS VARCHAR(2)), 2)) AS [LunchOut],        isnull((Select sum(isnull(DATEDIFF( MI ,Break1in,Break1Out),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1in,Break1Out)>0)      ),0)      +      isnull((Select sum(isnull(DATEDIFF ( MI , Break2in,Break2Out),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2in,Break2Out)>0)      ),0)           AS [LunchIn],             dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],                   dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], ta.dateoffice as PerformanceDate, Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,      dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL      ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,(select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,isnull(Right(CONVERT(VARCHAR(5),Ta.IN1,108),7),'') AS [InTime1] ,        Ta.OUT2 AS OutTime1,Branch_Name ,c.CompanyNAme,c.address as CompanyAddress,                                    convert(char(10),@fordate,103) as temp1,                 convert(char(10),@ToDate,103) as temp2,                 left(DATENAME(dw,dateoffice),3)  as temp3,                        (+LEFT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break2Shiftin,108),CONVERT(char(5), Break2Shiftout,108))) / 60)  AS VARCHAR(2)), 2) + ' : '         +RIGHT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break2Shiftin,108),CONVERT(char(5), Break2Shiftout,108))) % 60)  AS VARCHAR(2)), 2))          as temp4,                    (+RIGHT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break1Shiftin,108),CONVERT(char(5), Break1Shiftout,108))) / 60)  AS VARCHAR(2)), 2) +         ' : '         +RIGHT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break1Shiftin,108),CONVERT(char(5), Break1Shiftout,108))) % 60)  AS VARCHAR(2)), 2))         as temp5,                    (CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break2in,108),CONVERT(char(5),         Break2Out,108))) / 60) AS VARCHAR(8)) + ' : ' +RIGHT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5),         Break2in,108),CONVERT(char(5), Break2Out,108))) % 60)  AS VARCHAR(2)), 2)) as temp7,            ''     as temp10,(+right('0'+CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break2in,108),CONVERT(char(5), Break2Out,108))) / 60)  AS VARCHAR(2)), 2) + ' : ' +RIGHT('0'+ CAST(((select DATEDIFF(MINUTE,CONVERT(char(5),         Break2in,108),CONVERT(char(5), Break2Out,108))) % 60)  AS VARCHAR(2)), 2)) as  temp16,CONVERT(char(5), Break1Shiftin,108) as temp11,CONVERT(char(5), Break1Shiftout,108) as temp12,        CONVERT(char(5), Break1in,108) as temp6 , CONVERT(char(5), Break1Out,108) as temp8,CONVERT(char(5), Break2Shiftin,108) as temp13, CONVERT(char(5), Break2Shiftout,108) as temp14,                CONVERT(char(5), Break2in,108) as temp9, CONVERT(char(5), Break2Out,108) as temp15, dbo.convertTime((Select DATEDIFF (mi  ,Break1Shiftin,Break1in  ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp17,dbo.convertTime((Select DATEDIFF (mi  ,Break1Out,Break1Shiftout  ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp18, dbo.convertTime((Select DATEDIFF (mi  ,Break1in,Break1Shiftin) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp19, dbo.convertTime((Select DATEDIFF (mi  ,Break1Shiftout,Break1Out) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp20,  dbo.convertTime((Select DATEDIFF (mi  ,Break2Shiftin,Break2in ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp21,  dbo.convertTime((Select DATEDIFF (mi  ,Break2Out,Break2Shiftout ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp22,  dbo.convertTime((Select DATEDIFF (mi  ,Break2in,Break2Shiftin ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp23, dbo.convertTime((Select DATEDIFF ( MI , Break2Shiftout  , Break2Out) from Tran_Attendance  p where p.EmpId=ta.EmpId  and       p.RowId=ta.RowId )) as temp24,  dbo.convertTime(isnull((Select sum(isnull(DATEDIFF( MI ,Break1Shiftin,Break1in),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1Shiftin,Break1in)>0)      ),0) + isnull((Select sum(isnull(DATEDIFF ( MI , Break2Shiftin,Break2in),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2Shiftin,Break2in)>0)      ),0))  as temp25,    dbo.convertTime( isnull((Select sum(isnull(DATEDIFF( MI ,Break1Out,Break1Shiftout),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1Out,Break1Shiftout)>0)      ),0)  +    isnull((Select sum(isnull(DATEDIFF ( MI , Break2Out,Break2Shiftout),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2Out,Break2Shiftout)>0)      ),0)  )  as temp26, dbo.convertTime(isnull((Select sum(isnull(DATEDIFF( MI ,Break1in,Break1Shiftin),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1in,Break1Shiftin)>0)      ),0)      + isnull((Select sum(isnull(DATEDIFF ( MI , Break2in,Break2Shiftin),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2in,Break2Shiftin)>0)      ),0)     )  as temp27,dbo.convertTime(      isnull((Select sum(isnull(DATEDIFF( MI ,Break1Shiftout,Break1Out),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1Shiftout,Break1Out)>0)      ),0)  +      isnull((Select sum(isnull(DATEDIFF ( MI , Break2Shiftout,Break2Out),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2Shiftout,Break2Out)>0)      ),0)  ) as temp28, isnull((Select sum(isnull(DATEDIFF( MI ,Break1Shiftin,Break1Shiftout),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112)       ),0)     +  isnull((Select sum(isnull(DATEDIFF ( MI , Break2Shiftin,Break2Shiftout),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112)      ),0)  as temp29    FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e, Mst_Branch as  b,Mst_Company as c  WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid   and  convert(varchar,ta.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112)    And  me.Branchid=b.branchID And me.CompanyId=c.CompanyID      order By me.empid,ta.dateoffice                          end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySubPerformanceReport_SmartimeSingle]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlySubPerformanceReport_SmartimeSingle]                                                      @fordate smalldatetime,   @ToDate smallDatetime  as  begin SELECT  me.EmpCode AS PayCode,me.Empname, dept.Dept_name,                ta.presentvalue,Ta.OTDuration as OverTime, ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as  Hours_Worked,                 Holiday_Value as Holiday, Wo_Value as WO,CONVERT(char(5), SHIFTSTARTTIME,108) AS [ShiftStartTime], Ta.IN1 AS [InTime], Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,            Ta.STATUS AS Status,                  dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],  dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],                 ta.otduration as [cotduration],           (+right('0'+CAST(((select DATEDIFF(MINUTE,CONVERT(char(5),         Break1in,108),CONVERT(char(5), Break1Out,108))) / 60)  AS VARCHAR(2)), 2) + ' : ' +RIGHT('0'+CAST(((select DATEDIFF(MINUTE,CONVERT(char(5),      Break1in,108),CONVERT(char(5), Break1Out,108))) % 60)  AS VARCHAR(2)), 2)) AS [LunchOut],        isnull((Select sum(isnull(DATEDIFF( MI ,Break1in,Break1Out),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1in,Break1Out)>0)      ),0)      +      isnull((Select sum(isnull(DATEDIFF ( MI , Break2in,Break2Out),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2in,Break2Out)>0)      ),0)           AS [LunchIn],             dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],                   dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], ta.dateoffice as PerformanceDate, Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,      dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL      ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,(select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,isnull(Right(CONVERT(VARCHAR(5),Ta.IN1,108),7),'') AS [InTime1] ,        Ta.OUT2 AS OutTime1,Branch_Name ,c.CompanyNAme,c.address as CompanyAddress,                                    convert(char(10),@fordate,103) as temp1,                 convert(char(10),@ToDate,103) as temp2,                 left(DATENAME(dw,dateoffice),3)  as temp3,                        (+LEFT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break2Shiftin,108),CONVERT(char(5), Break2Shiftout,108))) / 60)  AS VARCHAR(2)), 2) + ' : '         +RIGHT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break2Shiftin,108),CONVERT(char(5), Break2Shiftout,108))) % 60)  AS VARCHAR(2)), 2))          as temp4,                    (+RIGHT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break1Shiftin,108),CONVERT(char(5), Break1Shiftout,108))) / 60)  AS VARCHAR(2)), 2) +         ' : '         +RIGHT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break1Shiftin,108),CONVERT(char(5), Break1Shiftout,108))) % 60)  AS VARCHAR(2)), 2))         as temp5,                    (CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break2in,108),CONVERT(char(5),         Break2Out,108))) / 60) AS VARCHAR(8)) + ' : ' +RIGHT('0' + CAST(((select DATEDIFF(MINUTE,CONVERT(char(5),         Break2in,108),CONVERT(char(5), Break2Out,108))) % 60)  AS VARCHAR(2)), 2)) as temp7,            ''     as temp10,(+right('0'+CAST(((select DATEDIFF(MINUTE,CONVERT(char(5), Break2in,108),CONVERT(char(5), Break2Out,108))) / 60)  AS VARCHAR(2)), 2) + ' : ' +RIGHT('0'+ CAST(((select DATEDIFF(MINUTE,CONVERT(char(5),         Break2in,108),CONVERT(char(5), Break2Out,108))) % 60)  AS VARCHAR(2)), 2)) as  temp16,CONVERT(char(5), Break1Shiftin,108) as temp11,CONVERT(char(5), Break1Shiftout,108) as temp12,        CONVERT(char(5), Break1in,108) as temp6 , CONVERT(char(5), Break1Out,108) as temp8,CONVERT(char(5), Break2Shiftin,108) as temp13, CONVERT(char(5), Break2Shiftout,108) as temp14,                CONVERT(char(5), Break2in,108) as temp9, CONVERT(char(5), Break2Out,108) as temp15, dbo.convertTime((Select DATEDIFF (mi  ,Break1Shiftin,Break1in  ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp17,dbo.convertTime((Select DATEDIFF (mi  ,Break1Out,Break1Shiftout  ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp18, dbo.convertTime((Select DATEDIFF (mi  ,Break1in,Break1Shiftin) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp19, dbo.convertTime((Select DATEDIFF (mi  ,Break1Shiftout,Break1Out) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp20,  dbo.convertTime((Select DATEDIFF (mi  ,Break2Shiftin,Break2in ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp21,  dbo.convertTime((Select DATEDIFF (mi  ,Break2Out,Break2Shiftout ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp22,  dbo.convertTime((Select DATEDIFF (mi  ,Break2in,Break2Shiftin ) from Tran_Attendance  p where p.EmpId=ta.EmpId  and      p.RowId=ta.RowId )) as temp23, dbo.convertTime((Select DATEDIFF ( MI , Break2Shiftout  , Break2Out) from Tran_Attendance  p where p.EmpId=ta.EmpId  and       p.RowId=ta.RowId )) as temp24,  dbo.convertTime(isnull((Select sum(isnull(DATEDIFF( MI ,Break1Shiftin,Break1in),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1Shiftin,Break1in)>0)      ),0) + isnull((Select sum(isnull(DATEDIFF ( MI , Break2Shiftin,Break2in),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2Shiftin,Break2in)>0)      ),0))  as temp25,    dbo.convertTime( isnull((Select sum(isnull(DATEDIFF( MI ,Break1Out,Break1Shiftout),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1Out,Break1Shiftout)>0)      ),0)  +    isnull((Select sum(isnull(DATEDIFF ( MI , Break2Out,Break2Shiftout),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2Out,Break2Shiftout)>0)      ),0)  )  as temp26, dbo.convertTime(isnull((Select sum(isnull(DATEDIFF( MI ,Break1in,Break1Shiftin),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1in,Break1Shiftin)>0)      ),0)      + isnull((Select sum(isnull(DATEDIFF ( MI , Break2in,Break2Shiftin),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2in,Break2Shiftin)>0)      ),0)     )  as temp27,dbo.convertTime(      isnull((Select sum(isnull(DATEDIFF( MI ,Break1Shiftout,Break1Out),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF( MI ,Break1Shiftout,Break1Out)>0)      ),0)  +      isnull((Select sum(isnull(DATEDIFF ( MI , Break2Shiftout,Break2Out),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112) and (DATEDIFF ( MI , Break2Shiftout,Break2Out)>0)      ),0)  ) as temp28, isnull((Select sum(isnull(DATEDIFF( MI ,Break1Shiftin,Break1Shiftout),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112)       ),0)     +  isnull((Select sum(isnull(DATEDIFF ( MI , Break2Shiftin,Break2Shiftout),0)) from Tran_Attendance  p  where p.EmpId=ta.EmpId  and        convert(varchar,p.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112)      ),0)  as temp29    FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e, Mst_Branch as  b,Mst_Company as c  WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid   and  convert(varchar,ta.dateoffice,112) between convert(varchar,@fordate,112) and  convert(varchar,@Todate,112)    And  me.Branchid=b.branchID And me.CompanyId=c.CompanyID      order By me.empid,ta.dateoffice                          end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySubPerformanceReport1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlySubPerformanceReport1]   
  
@fordate smalldatetime,  
@ToDate smallDatetime

as

begin
SELECT     me.EmpCode AS PayCode,me.Empname, dept.Dept_name, ta.presentvalue,Ta.OTDuration as OverTime, ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as 
Hours_Worked,Holiday_Value as Holiday, Wo_Value as WO,Right(CONVERT(NVARCHAR(20),Ta.SHIFTSTARTTIME,100),7) AS [ShiftStartTime], 
           Ta.IN1 AS [OutTime],ta.Out2 as OutTime, dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,
           Ta.STATUS AS Status,  dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],
           dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],ta.otduration as [cotduration],Ta.OUT1 AS [LunchOut], Ta.IN2 AS [LunchIn],dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],
		   dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration], Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay], 
          ta.dateoffice  as PerformanceDate, Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,
		   dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss, Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL
		   ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,(select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,isnull(Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7),'') AS [InTime1] ,
       isnull(left(CONVERT(NVARCHAR(5),Ta.OUT2,108),7),'') AS OutTime1
			
	FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e
	WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid
	 and  convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112)   	order By me.empid,ta.dateoffice  


end


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySubPerformanceReportnew]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[Select_MonthlySubPerformanceReportnew]    
       --'09/01/2017','09/06/2017'  
    
 @fordate smalldatetime,   @ToDate smallDatetime  as  begin  
  
SELECT me.EmpCode AS PayCode,me.Empname, dept.Dept_name, ta.presentvalue,Ta.OTDuration as OverTime,  
 ta.absentvalue,ta.leaveValue as Leave,Ta.SHIFTATTENDED AS Shift,ta.HoursWorked as  Hours_Worked,Holiday_Value as Holiday,    
 Wo_Value as WO,Right(CONVERT(NVARCHAR(20),Ta.SHIFTSTARTTIME,100),7) AS [ShiftStartTime],             Ta.IN1 AS [InTime],  
 Ta.OUT2 AS [OutTime], dbo.convertTime(Ta.HOURSWORKED) AS [HoursWorks],BSalary,            Ta.STATUS AS Status,    
 dbo.convertTime(Ta.LATEARRIVAL) AS [LateArrival],Ta.LATEARRIVAL as [Clatearrival],            dbo.convertTime(Ta.OTDURATION) AS [OTDuration1],  
 ta.otduration as [cotduration],convert(Nchar(05),Ta.OUT1,108) AS [LunchOut],convert(Nchar(5), Ta.IN2,108) AS [LunchIn],  
 dbo.convertTime(Ta.EARLYARRIVAL) AS [EarlyArrival],Ta.EARLYARRIVAL  as [earlyarrival1],  dbo.convertTime(Ta.EARLYDEPARTURE) AS [EarlyDeparture], ta.earlydeparture as [cearlydeparture],  
 dbo.convertTime(Ta.EXCLUNCHHOURS) AS [ExcessLunchHour],dbo.convertTime(Ta.OTDURATION) AS [OTDuration],   
 Ta.OTAMOUNT AS [OTAmount], dbo.convertTime(Ta.OSDURATION) AS [OverStay],           ta.dateoffice as PerformanceDate,   
 Ta.LEAVECODE as Leave1 , Ta.TOTALLOSSHRS,dbo.convertTime(datediff(mi,out1,in2)) as AccessLunch,  
 dbo.convertTime(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME)) as BreakTime,        
 dbo.convertTime((datediff(mi,out1,in2))-(datediff(mi,LUNCHSTARTTIME,LUNCHENDTIME))) as timeloss,   
 Ta.LUNCHEARLYDEPARTURE, Ta.LUNCHLATEARRIVAL      ,ta.LEAVEVALUE as Cleave,ta.ABSENTVALUE as CAbsent,ta.presentvalue as Cpresent,  
 (select count(*) from  Temp_EmpId) as TotalEmp , Day(dateoffice) as Days,
 
 
 isnull(Right(CONVERT(NVARCHAR(5),Ta.IN1,108),7),'') AS [InTime1] ,  
 isnull(Right(CONVERT(NVARCHAR(5),Ta.OUT2,108),7),'') AS OutTime1,
 
 Branch_Name ,c.CompanyNAme,c.address as CompanyAddress, convert(Nchar(10),@fordate,103) as temp1,convert(Nchar(10),@ToDate,103) as temp2,  
 left(DATENAME(dw,dateoffice),3)  as temp3,  
 desg.Desig_Name as temp4,  
ta.CoreDays as temp5, 
 
ISNULL(ta.CoreDayCount,0)  as temp6,  
 (select sum(isnull(taa.CoreDayCount,0)) from dbo.Tran_Attendance AS Taa where 
 convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112)  
 
 ) as temp7 ,  
 't1' as temp8 ,  
 't1' as temp9 ,  
 't1' as temp10,     
 't1' as temp11,   
 't1' as temp12,   
 't1' as temp13     
   
FROM dbo.Tran_Attendance AS Ta , dbo.Mst_Employee AS me, dbo.Mst_Department DEPT,Temp_EmpId as e, Mst_Branch as  b,Mst_Company as c ,mst_designation as desg  
WHERE me.empid =ta.empid and  me.empid =e.empid and me.deptid =dept.deptid  and me.DesigId=desg.DesigId  and  convert(Nvarchar,ta.dateoffice,112) between convert(Nvarchar,@fordate,112) and  convert(Nvarchar,@Todate,112)    And  me.Branchid=b.branchID And me.
CompanyId=c.CompanyID   order By me.empid,ta.dateoffice        
end    
set ANSI_NULLS ON    
set QUOTED_IDENTIFIER ON


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySummaryReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE    procedure [dbo].[Select_MonthlySummaryReport]      
     
@frdt smalldatetime,    
@trdt smalldatetime    
as    
select b.empcode,b.Empname,    
sum(presentvalue) as Present,sum(absentvalue) as absent,    
 CAST((sum(HoursWorked) / 60) AS NVARCHAR(8)) + ' : ' +   
       RIGHT('0' + CAST((sum(HoursWorked) % 60)  AS NVARCHAR(2)), 2) as HoursWorked ,  
  
isnull(replicate('0',2-len(sum(otduration) /60))+ cast(sum(otduration) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(otduration)%60))+cast(sum(otduration)%60 as Nvarchar(2)),'00') +' Mins' as OtHrs,    
ISNULL((select count(empid) from tran_attendance where empid=a.empid and otduration>0 AND dateoffice between  @frdt and @trdt),0) AS OtDays,    

ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 And rtrim(ltrim(Status)) ='CL' AND dateoffice between @frdt and @trdt),0)  as CL,
ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 AND  rtrim(ltrim(Status)) ='PL' And dateoffice between @frdt and @trdt),0)  as PL,
ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 AND rtrim(ltrim(Status)) ='SL' And  dateoffice between @frdt and @trdt),0)  as SL,

ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 AND dateoffice between @frdt and @trdt),0)  as totalleave,    
isnull(replicate('0',2-len(sum(LateArrival) /60))+ cast(sum(LateArrival) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(LateArrival)%60))+cast(sum(LateArrival)%60 as Nvarchar(2)),'00') +' Mins' as 'LateComingHrs', 
ISNULL((select count(empid) from Dbo.tran_attendance where empid=a.empid and LATEARRIVAL>0 AND dateoffice between  @frdt and @trdt),0) AS LateCommDays,  
 isnull(replicate('0',2-len(sum(EarlyDeparture) /60))+ cast(sum(EarlyDeparture) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(EarlyDeparture)%60))+cast(sum(EarlyDeparture)%60 as Nvarchar(2)),'00') +' Mins' as 'EarlierGoingHrs',
ISNULL((select count(empid) from dbo.tran_attendance where empid=a.empid and EARLYDEPARTURE>0 AND dateoffice between  @frdt and @trdt),0) AS EarlyGoingDays,    
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='WO' AND dateoffice between @frdt and @trdt),0) AS Weekoff,    
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='POW' AND dateoffice between @frdt and @trdt),0) AS WeekoffPresent,    
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='HLD' AND dateoffice between @frdt and @trdt),0) AS Holiday,    
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='POH' AND dateoffice between @frdt and @trdt),0) AS HolidayPresent    
From dbo.tran_attendance a, dbo.Mst_Employee b,dbo.Temp_EmpId c where a.empid=c.empid and  a.empid=b.empid and  dateoffice between @frdt and @trdt    
group by a.empid,b.empcode ,b.Empname


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySummaryReport_Old]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_MonthlySummaryReport_Old]
@frdt smalldatetime,
@trdt smalldatetime
as
select b.empcode,sum(presentvalue) as Present,sum(absentvalue) as absent,
isnull(replicate('0',2-len(sum(otduration) /60))+ cast(sum(otduration) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(otduration)%60))+cast(sum(otduration)%60 as Nvarchar(2)),'00') +' Mins' as OtHrs,
ISNULL((select count(empid) from tran_attendance where empid=a.empid and otduration>0 AND dateoffice between  @frdt and @trdt),0) AS OtDays,
ISNULL((select sum(leavevalue) from tran_attendance where empid=a.empid and leavecode='CL' AND dateoffice between @frdt and @trdt),0) AS CL,
ISNULL((select sum(leavevalue) from tran_attendance where empid=a.empid and leavecode='PL' AND dateoffice between @frdt and @trdt),0) AS PL,
ISNULL((select sum(leavevalue) from tran_attendance where empid=a.empid and leavecode='SL' AND dateoffice between @frdt and @trdt),0) AS SL,
0 as totalleave,ISNULL((select count(empid) from tran_attendance where empid=a.empid and LATEARRIVAL>0 AND dateoffice between  @frdt and @trdt),0) AS LateCommDays,
isnull(replicate('0',2-len(sum(LATEARRIVAL) /60))+ cast(sum(LATEARRIVAL) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(LATEARRIVAL)%60))+cast(sum(LATEARRIVAL)%60 as Nvarchar(2)),'00') +' Mins' as LateCommHrs,
ISNULL((select count(empid) from tran_attendance where empid=a.empid and EARLYDEPARTURE>0 AND dateoffice between  @frdt and @trdt),0) AS EarlyGoingDays,
isnull(replicate('0',2-len(sum(EARLYDEPARTURE) /60))+ cast(sum(EARLYDEPARTURE) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(EARLYDEPARTURE)%60))+cast(sum(EARLYDEPARTURE)%60 as Nvarchar(2)),'00') +' Mins' as EarlyGoingHrs,
ISNULL((select count(status) from tran_attendance where empid=a.empid and status='WO' AND dateoffice between @frdt and @trdt),0) AS Weekoff,
ISNULL((select count(status) from tran_attendance where empid=a.empid and status='POW' AND dateoffice between @frdt and @trdt),0) AS WeekoffPresent,
ISNULL((select count(status) from tran_attendance where empid=a.empid and status='HLD' AND dateoffice between @frdt and @trdt),0) AS Holiday,
ISNULL((select count(status) from tran_attendance where empid=a.empid and status='POH' AND dateoffice between @frdt and @trdt),0) AS HolidayPresent
From tran_attendance a, Mst_Employee b,Temp_EmpId c where a.empid=c.empid and  a.empid=b.empid and  dateoffice between @frdt and @trdt
group by a.empid,b.empcode


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySummaryReportM]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE    procedure [dbo].[Select_MonthlySummaryReportM]        
       
@frdt smalldatetime,      
@trdt smalldatetime      
as      
select b.empcode,b.Empname,      
sum(presentvalue) as Present,sum(absentvalue) as absent,      
 CAST((sum(HoursWorked) / 60) AS NVARCHAR(8)) + ' : ' +     
       RIGHT('0' + CAST((sum(HoursWorked) % 60)  AS NVARCHAR(2)), 2) as HoursWorked ,    
    
isnull(replicate('0',2-len(sum(otduration) /60))+ cast(sum(otduration) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(otduration)%60))+cast(sum(otduration)%60 as Nvarchar(2)),'00') +' Mins' as OtHrs,      
ISNULL((select count(empid) from tran_attendance where empid=a.empid and otduration>0 AND dateoffice between  @frdt and @trdt),0) AS OtDays,      
  
ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 And rtrim(ltrim(Status)) ='CL' AND dateoffice between @frdt and @trdt),0)  as CL,  
ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 AND  rtrim(ltrim(Status)) ='PL' And dateoffice between @frdt and @trdt),0)  as PL,  
ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 AND rtrim(ltrim(Status)) ='SL' And  dateoffice between @frdt and @trdt),0)  as SL,  
  
ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 AND dateoffice between @frdt and @trdt),0)  as totalleave,      
isnull(replicate('0',2-len(sum(LateArrival) /60))+ cast(sum(LateArrival) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(LateArrival)%60))+cast(sum(LateArrival)%60 as Nvarchar(2)),'00') +' Mins' as 'LateComingHrs',   
ISNULL((select count(empid) from Dbo.tran_attendance where empid=a.empid and LATEARRIVAL>0 AND dateoffice between  @frdt and @trdt),0) AS LateCommDays,    
 isnull(replicate('0',2-len(sum(EarlyDeparture) /60))+ cast(sum(EarlyDeparture) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(EarlyDeparture)%60))+cast(sum(EarlyDeparture)%60 as Nvarchar(2)),'00') +' Mins' as 'EarlierGoingHrs',  
ISNULL((select count(empid) from dbo.tran_attendance where empid=a.empid and EARLYDEPARTURE>0 AND dateoffice between  @frdt and @trdt),0) AS EarlyGoingDays,      
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='WO' AND dateoffice between @frdt and @trdt),0) AS Weekoff,      
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='POW' AND dateoffice between @frdt and @trdt),0) AS WeekoffPresent,      
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='HLD' AND dateoffice between @frdt and @trdt),0) AS Holiday,      
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='POH' AND dateoffice between @frdt and @trdt),0) AS HolidayPresent      
From dbo.tran_attendance a, dbo.Mst_Employee b,dbo.Temp_EmpId c where a.empid=c.empid and  a.empid=b.empid and  dateoffice between @frdt and @trdt      
group by a.empid,b.empcode ,b.Empname


GO
/****** Object:  StoredProcedure [dbo].[Select_MonthlySummaryReporttest]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   procedure [dbo].[Select_MonthlySummaryReporttest]   
@frdt smalldatetime,  
@trdt smalldatetime  
as  
select b.empcode,b.Empname,  
sum(presentvalue) as Present,sum(absentvalue) as absent,  
 CAST((sum(HoursWorked) / 60) AS NVARCHAR(8)) + ' Hours ' + 
       RIGHT('0' + CAST((sum(HoursWorked) % 60) +' Mins' AS NVARCHAR(2)), 2) as HoursWorked ,



isnull(replicate('0',2-len(sum(otduration) /60))+ cast(sum(otduration) /60 as Nvarchar(2)),'00') +' Hours '+isnull(replicate('0',2-len(sum(otduration)%60))+cast(sum(otduration)%60 as Nvarchar(2)),'00') +' Mins' as OtHrs,  
ISNULL((select count(empid) from tran_attendance where empid=a.empid and otduration>0 AND dateoffice between  @frdt and @trdt),0) AS OtDays,  
ISNULL((select sum(LeaveValue) from tran_attendance where empid=a.empid and LeaveValue>0 AND dateoffice between @frdt and @trdt),0)  as totalleave,  
  
ISNULL((select count(empid) from Dbo.tran_attendance where empid=a.empid and LATEARRIVAL>0 AND dateoffice between  @frdt and @trdt),0) AS LateCommDays,  
ISNULL((select count(empid) from dbo.tran_attendance where empid=a.empid and EARLYDEPARTURE>0 AND dateoffice between  @frdt and @trdt),0) AS EarlyGoingDays,  
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='WO' AND dateoffice between @frdt and @trdt),0) AS Weekoff,  
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='POW' AND dateoffice between @frdt and @trdt),0) AS WeekoffPresent,  
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='HLD' AND dateoffice between @frdt and @trdt),0) AS Holiday,  
ISNULL((select count(status) from dbo.tran_attendance where empid=a.empid and status='POH' AND dateoffice between @frdt and @trdt),0) AS HolidayPresent  
From dbo.tran_attendance a, dbo.Mst_Employee b,dbo.Temp_EmpId c where a.empid=c.empid and  a.empid=b.empid and  dateoffice between @frdt and @trdt  
group by a.empid,b.empcode ,b.Empname


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Bank]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Bank]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Bank
*/

          @BankID int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [BankID],[Bank_Name],[Bank_Description],[Active] FROM [Mst_Bank]  WHERE   [BankID] = @BankID ORDER BY [BankID]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Bank_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Bank_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Bank_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [BankID],[Bank_Name],[Bank_Description]  FROM [Mst_Bank]  Order by [BankID]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Bank_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Bank_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Bank_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [BankID],[Bank_Name]  FROM [Mst_Bank]  Order by [Bank_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Bank_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Bank_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Bank_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [Bank_Name],[Bank_Description]  FROM [Mst_Bank]  Order by [Bank_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Branch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Branch]  
/*  
     Create by : Yogendra Singh  
    Create Date : Mar 30 2012  
    Modify Date : Mar 30 2012   
    Notes : Select_Mst_Branch  
*/  
  
          @BranchId int  
  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
   SELECT [BranchId],[Branch_Name],[Address],[PhoneNo],[EmailId],CompanyId FROM [Mst_Branch]  WHERE   [BranchId] = @BranchId ORDER BY [BranchId]  
    
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Branch_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Branch_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Branch_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [BranchId],[Branch_Name],[Address],[PhoneNo],[EmailId]  FROM [Mst_Branch]  Order by [BranchId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Branch_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Branch_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Branch_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [BranchId],[Branch_Name],[PhoneNo],[EmailId]  FROM [Mst_Branch]  Order by [Branch_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Branch_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Branch_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Branch_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [Branch_Name],[Address],[PhoneNo],[EmailId]  FROM [Mst_Branch]  Order by [Branch_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Company]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[Select_Mst_Company]      
/*      
     Create by : SHarad Baliyan    
    Create Date : Aug 13 2012      
    Modify Date : Aug 13 2012       
    Notes : Select_Mst_Company      
*/      
      
          @CompanyId int      
      
 AS      
      
  SET NOCOUNT ON      
  BEGIN       
      
   SELECT [CompanyId],[CompanyName],[Description],[Address],[PhoneNo],[EmailId],[Vat_No],[Pf_No],[Tan_No],[Reg_No],[Esi_No],[Pan_No],[PF],[FPF],    
[ESI],[Addition1],[Addition2],[Addition3],[Addition4],[Addition5], [Addition6],[Addition7],[Addition8],[Addition9],[Addition10],    
[Ded1],[Ded2],[Ded3],[Ded4],[Ded5] ,[FDed1],[FDed2],[FDed3],[FDed4],[FDed5],PPF  FROM [Mst_Company]  WHERe    
  [CompanyId] = @CompanyId ORDER BY [CompanyId]      
        
  END      
  SET NOCOUNT OFF      
      
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Company_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Company_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Company_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT *  FROM [Mst_Company]  Order by [CompanyId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Company_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Company_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Company_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [CompanyId],[CompanyName]  FROM [Mst_Company]  Order by [CompanyName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Company_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Company_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Company_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [CompanyName],[Description],[Address],[PhoneNo] ,[Vat_No],[Pf_No],[Tan_No],[Reg_No],[Esi_No],[Pan_No]  FROM [Mst_Company]  Order by [CompanyName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Company_Print1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Select_Mst_Company_Print1]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Company_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [CompanyName],[Description],[Address],'Phone: '+ltrim(rtrim([PhoneNo])) + ' Email: '+ltrim(rtrim([EmailId])) as [PhoneNo] ,[Vat_No],[Pf_No],[Tan_No],[Reg_No],[Esi_No],[Pan_No]  FROM [Mst_Company]  Order by [CompanyName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_CorpPolicy_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_CorpPolicy_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_CorpPolicy_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT dbo.FmtTime([DuplidatePunchMin]) AS [DuplidatePunchMin],dbo.FmtTime([MaxEarlyComming]) AS [MaxEarlyComming],dbo.FmtTime([MaxLateGoing]) AS [MaxLateGoing],[MinPresentForWO],[AWAasAAA],[OTFormula],[WorkHrCalc],[ShowPayroll]  FROM [Mst_CorpPolicy]  Order by [DuplidatePunchMin]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Department]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Department]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 28 2012
	   Modify Date	: Mar 28 2012 
	   Notes	: Select_Mst_Department
*/

          @DeptId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [DeptId],[Dept_Name],[Dept_Description],[Active] FROM [Mst_Department]  WHERE   [DeptId] = @DeptId 
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Department_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Department_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 28 2012
	   Modify Date	: Mar 28 2012 
	   Notes	: Select_Mst_Department_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [DeptId],[Dept_Name],[Dept_Description]  FROM [Mst_Department]  Order by [DeptId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Department_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Department_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 28 2012
	   Modify Date	: Mar 28 2012 
	   Notes	: Select_Mst_Department_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [DeptId],[Dept_Name]  FROM [Mst_Department]  Order by [Dept_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Department_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Department_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Department_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [Dept_Name],[Dept_Description]  FROM [Mst_Department]  Order by [Dept_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Designation]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Designation]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012 
	   Notes	: Select_Mst_Designation
*/

          @DesigId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [DesigId],[Desig_Name],[Desig_Description] FROM [Mst_Designation]  WHERE   [DesigId] = @DesigId ORDER BY [DesigId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Designation_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Designation_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012 
	   Notes	: Select_Mst_Designation_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [DesigId],[Desig_Name],[Desig_Description]  FROM [Mst_Designation]  Order by [DesigId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Designation_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Designation_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012 
	   Notes	: Select_Mst_Designation_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [DesigId],[Desig_Name]  FROM [Mst_Designation]  Order by [DesigId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Designation_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Designation_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Designation_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [Desig_Name],[Desig_Description]  FROM [Mst_Designation]  Order by [Desig_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Email]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Proc [dbo].[Select_Mst_Email]
as
begin

Select * from mst_Email

end


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Employee]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Employee] 
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_Employee
*/

          @EmpId numeric(18,0)

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmpId],[pwd],[EmpName],[FatherName],[EmpCode],[CardNo],[CompanyId],[DeptId],[DesigId],[BranchId],[OTimePoliceId],convert(Nchar(10),[DateofJoin],103) as  [DateofJoin],[ShiftId],[ReginDate],[SuperiourName],[ShiftType],[ShiftPatternId],[IsAutoShift],[Auto_Shifts],[FirstOffDay],[SecondOffDayType],[SecondOffDay],[HalfDayShiftId],[SecondWeekOffDays],[ShiftRemaindays],[CDays],convert(Nchar(10),[ShiftStartDate],103) as [ShiftStartDate] ,[ShiftCode],[HalfDayShiftCode],[ImagePath],[EmailAddress],[Bsalary] FROM [Mst_Employee]  WHERE   [EmpId] = @EmpId ORDER BY [EmpId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Employee_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Employee_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_Employee_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmpId],[EmpName],[FatherName],[EmpCode],[Dept_Name],[Desig_Name],convert(Nchar(10),[DateofJoin],103) as [DateofJoin]
		 FROM [Mst_Employee] a,[mst_DEpartment] b, [mst_designation] c
		where a.[DeptId]=b.[DeptId] and a.DesigId=c.DesigId Order by [EmpId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Employee_All_Search]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Employee_All_Search] 
(@empname Nvarchar(80),
@deptname Nvarchar(80))
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_Employee_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmpId],[EmpName],[CardNo],[FatherName],[EmpCode],[Dept_Name],[Desig_Name],convert(Nchar(10),[DateofJoin],103) as [DateofJoin]
		 FROM [Mst_Employee] a,[mst_DEpartment] b, [mst_designation] c
		where a.[DeptId]=b.[DeptId] and a.DesigId=c.DesigId and b.dept_name like '%'+@deptname +'%'   and  a.empname like  '%'+@empname +'%'  Order by [EmpId]
		
		END
		SET NOCOUNT OFF

		RETURN



select * from [mst_DEpartment]


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Employee_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Employee_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_Employee_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmpId],+ltrim(rtrim([EmpCode])) +' ' +ltrim(rtrim([EmpName])) as[EmpName] FROM [Mst_Employee]  Order by [EmpName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Employee_List1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Employee_List1]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_Employee_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmpId],ltrim(rtrim(EmpCode))+' : '+ltrim(rtrim(EmpName)) as [EmpName]  FROM [Mst_Employee]  Order by [EmpName]
	


		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Employee_manualPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Employee_manualPunch]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_Employee
*/

          @Empcode Nvarchar(50)

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmpId],[EmpName],[SuperiourName],[FatherName],Mst_Department.Dept_name as Dept_Name, [EmpCode],[CardNo],[CompanyId],[Mst_Employee].[DeptId],[DesigId],[BranchId],[OTimePoliceId],convert(Nchar(10),[DateofJoin],103) as  [DateofJoin],[ShiftId],[ShiftType],[ShiftPatternId],[IsAutoShift],[Auto_Shifts],[FirstOffDay],[SecondOffDayType],[SecondOffDay],[HalfDayShiftId],[SecondWeekOffDays],[ShiftRemaindays],[CDays],convert(Nchar(10),[ShiftStartDate],103) as [ShiftStartDate] ,[ShiftCode],[HalfDayShiftCode] FROM [Mst_Employee] ,Mst_Department  WHERE Mst_Department.Deptid=[Mst_Employee].DEPTID and   [Empcode] = @Empcode ORDER BY [EmpId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Employee_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Employee_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Holiday_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			 select empname,FatherName,EmpCode,CardNo,convert(Nchar(10),DateofJoin,103) as DateofJoin,
			convert(Nchar(10),ShiftStartDate,103) as ShiftStartDate,
			b.CompanyName,c.Dept_Name,d.Desig_Name,e.Branch_Name,f.OfficeTimePolicyName,
			g.ShiftName,g.ShiftType,g.FirstOffDay,g.SecondOffDayType,g.SecondOffDay,g.SecondWeekOffDays
			From Mst_Employee a,Mst_Company b,Mst_Department C,Mst_Designation d,Mst_Branch e,
			Mst_EmpOfficeTime f,Mst_Shift g
			where a.CompanyId=b.CompanyId and a.DeptId =c.DeptId and a.DesigId=d.DesigId
			and a.branchid=e.BranchId and a.OTimePoliceId =f.OTimePoliceId and a.shiftid=g.ShiftId
			order by EmpCode		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_EmploymentType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_EmploymentType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_EmploymentType
*/

          @EmploymentTypeId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmploymentTypeId],[EmploymentTypeName],[EmploymentTypeDesc] FROM [Mst_EmploymentType]  WHERE   [EmploymentTypeId] = @EmploymentTypeId ORDER BY [EmploymentTypeId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_EmploymentType_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_EmploymentType_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_EmploymentType_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmploymentTypeId],[EmploymentTypeName],[EmploymentTypeDesc]  FROM [Mst_EmploymentType]  Order by [EmploymentTypeId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_EmploymentType_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_EmploymentType_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_EmploymentType_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [EmploymentTypeName],[EmploymentTypeDesc]  FROM [Mst_EmploymentType]  Order by [EmploymentTypeName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_EmpOfficeTime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_Mst_EmpOfficeTime]  
/*  
     Create by : Yogendra Singh  
    Create Date : Apr 12 2012  
    Modify Date : Apr 12 2012   
    Notes : Select_Mst_EmpOfficeTime  
*/  
  
          @OTimePoliceId int  
  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
   SELECT [OTimePoliceId],[OfficeTimePolicyName],dbo.FmtTime([LateHour]) as  [LateHour],dbo.FmtTime([EarlyHour]) as  [EarlyHour],  
   dbo.FmtTime([DayMaxworkHour]) as [DayMaxworkHour],dbo.FmtTime([PresentDuration]) as [PresentDuration],  
   dbo.FmtTime([HalfDayWorkHour]) as [HalfDayWorkHour],dbo.FmtTime([HalfDayAbsentHour]) as [HalfDayAbsentHour],[RoundClock],  
   [TimeLoss],[HalfDay],[ShortLeave],[OverStay],[OverTime],[OTRate],[RequiredPunch],[SinglePunchValue]   ,LateTime
   FROM [Mst_EmpOfficeTime]  WHERE   [OTimePoliceId] = @OTimePoliceId ORDER BY [OTimePoliceId]  
    
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_EmpOfficeTime_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_EmpOfficeTime_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_EmpOfficeTime_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [OTimePoliceId],[OfficeTimePolicyName],dbo.FmtTime([LateHour]) as [LateHour],dbo.FmtTime([EarlyHour]) as [EarlyHour],
			dbo.FmtTime([DayMaxworkHour]) as [DayMaxworkHour],dbo.FmtTime([PresentDuration]) as [PresentDuration],
			dbo.FmtTime([HalfDayWorkHour]) as[HalfDayWorkHour],	
			[HalfDayAbsentHour]= CASE [RequiredPunch] WHEN 0 THEN 'No Punch' WHEN 1 THEN 'Single Punch' 
			WHEN 1 THEN 'Two Punch' WHEN 4 THEN 'Four Punch' WHEN 5 THEN 'Multiple Punch' ELSE 'Multiple Punch' END
		   FROM [Mst_EmpOfficeTime]  Order by [OTimePoliceId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_EmpOfficeTime_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_EmpOfficeTime_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_EmpOfficeTime_List
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [OTimePoliceId],[OfficeTimePolicyName] FROM [Mst_EmpOfficeTime]  Order by [OfficeTimePolicyName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_EmpOfficeTime_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Select_Mst_EmpOfficeTime_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_EmpOfficeTime
*/


	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [OTimePoliceId],[OfficeTimePolicyName],dbo.FmtTime([LateHour]) as  [LateHour],dbo.FmtTime([EarlyHour]) as  [EarlyHour],
			dbo.FmtTime([DayMaxworkHour]) as [DayMaxworkHour],dbo.FmtTime([PresentDuration]) as [PresentDuration],
			dbo.FmtTime([HalfDayWorkHour]) as [HalfDayWorkHour],dbo.FmtTime([HalfDayAbsentHour]) as [HalfDayAbsentHour],[RoundClock],
			[TimeLoss],[HalfDay],[ShortLeave],[OverStay],[OverTime],[OTRate],[RequiredPunch],[SinglePunchValue] 
			FROM [Mst_EmpOfficeTime] ORDER BY [OTimePoliceId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Grade]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Grade]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Grade
*/

          @GradeId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [GradeId],[Grade_Nme],[Grade_Description] FROM [Mst_Grade]  WHERE   [GradeId] = @GradeId ORDER BY [GradeId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Grade_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Grade_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Grade_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [GradeId],[Grade_Nme],[Grade_Description]  FROM [Mst_Grade]  Order by [GradeId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Grade_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Grade_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Grade_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [GradeId],[Grade_Nme]  FROM [Mst_Grade]  Order by [Grade_Nme]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Grade_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Grade_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Grade_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [Grade_Nme],[Grade_Description]  FROM [Mst_Grade]  Order by [Grade_Nme]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Holiday]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Holiday]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Holiday
*/

          @HolidayId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [HolidayId],[HolidayName],convert(Nchar(10),[HolidayDate],103) as [HolidayDate],[CompId],[Description],[IsAdjustment],convert(Nchar(10),[AdjustmentDate],103) [AdjustmentDate] FROM [Mst_Holiday]  WHERE   [HolidayId] = @HolidayId ORDER BY [HolidayId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Holiday_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Holiday_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Holiday_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [HolidayId],[HolidayName],convert(Nchar(10),[HolidayDate],103) as [HolidayDate],[CompanyName]  FROM [Mst_Holiday] A,[Mst_Company] b
			WHERE a.compId =b.companyId   Order by [HolidayId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Holiday_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Holiday_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Holiday_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [HolidayName],convert(Nchar(10),[HolidayDate],103) as [HolidayDate],CompanyName,a.[Description],convert(Nchar(10),[AdjustmentDate],103) as [AdjustmentDate]
		  FROM [Mst_Holiday]a, Mst_Company b where a.CompId =b.CompanyId  Order by [HolidayDate],CompanyName
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_LeaveApplication_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_LeaveApplication_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 28 2012
	   Modify Date	: Mar 28 2012 
	   Notes	: Select_Mst_Department_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [RwId], [EmpId], [Leaveid], [Fromdate], [Todate], [ApprovedStatus] FROM [Mst_LeaveApplication]  Order by [EmpId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_LeaveType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_LeaveType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_LeaveType
*/

          @LeaveTypeId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [LeaveTypeId],[LTypeCode],[LTypeName],[WeekOff],[Holiday],[IsAccrual],[AccrualType],[Fixmin],[Fixmax],[CarryPresent],[CarryLeave],[MaxAccrual],[Paid] FROM [Mst_LeaveType]  WHERE   [LeaveTypeId] = @LeaveTypeId ORDER BY [LeaveTypeId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_LeaveType_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_LeaveType_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_LeaveType_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [LeaveTypeId],[LTypeCode],[LTypeName],[WeekOff]=CASE [WeekOff] WHEN 1 THEN 'Yes' ELSE 'No' END ,
			[Holiday] = CASE [Holiday] WHEN 1 THEN 'Yes' ELSE 'No' END,[IsAccrual]= CASE [IsAccrual] WHEN 1 THEN 'Yes' ELSE 'No' END 
			FROM [Mst_LeaveType]  Order by [LeaveTypeId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_LeaveType_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_LeaveType_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_LeaveType_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [LeaveTypeId],[LTypeName] FROM [Mst_LeaveType]  Order by [LTypeName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_LeaveType_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_LeaveType_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_LeaveType_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [LTypeCode],[LTypeName],[WeekOff],[Holiday],[IsAccrual],[AccrualType],[Fixmin],[Fixmax],[CarryPresent],[CarryLeave],[MaxAccrual],[Paid]  FROM [Mst_LeaveType]  Order by [LTypeName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_MachineType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_MachineType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 18 2012
	   Modify Date	: Apr 18 2012 
	   Notes	: Select_Mst_MachineType
*/

          @McTypeId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [McTypeId],[McTypeName],[PortNo] FROM [Mst_MachineType]  WHERE   [McTypeId] = @McTypeId ORDER BY [McTypeId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_MachineType_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_MachineType_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 18 2012
	   Modify Date	: Apr 18 2012 
	   Notes	: Select_Mst_MachineType_List
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [McTypeId],[McTypeName]  FROM [Mst_MachineType]  Order by [McTypeId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_SalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_Mst_SalaryDetail]   
/*  
     Create by : Sharad Baliyan  
    Create Date : Aug 11 2012  
    Modify Date : Aug 11 2012   
    Notes : Select_Mst_SalaryDetail  
*/  
  
          @EmpId numeric(18,0)  
  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
   SELECT empcode,empname,fathername,dept_name,DESIG_NAME,a.* 
   FROM [Mst_SalaryDetail] a,mst_department b,mst_designation c,mst_employee d  
   where  a.empid=d.empid and  d.deptid=b.deptid and d.desigid=c.desigid  AND A.[EmpId] = @EmpId   
    
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_SalaryDetail_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_SalaryDetail_All]  
/*  
     Create by : Sharad  Kumar  
    Create Date : Aug 11 2012  
    Modify Date : Aug 11 2012   
    Notes : Select_Mst_SalaryDetail_All  
*/  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
   SELECT a.[EmpId],empcode,empname,fathername,dept_name,desig_name  
      FROM [Mst_SalaryDetail] a,mst_department b,mst_designation c,mst_employee d  
   where  a.empid=d.empid and  d.deptid=b.deptid and d.desigid=c.desigid  Order by empcode  
    
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_SalaryDetailforProcess]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[Select_Mst_SalaryDetailforProcess]   
/*    
     Create by : Sharad Baliyan    
    Create Date : Aug 11 2012    
    Modify Date : Aug 11 2012     
    Notes : Select_Tran_PaidSalaryDetail    
*/    
    
          @EmpId numeric(18,0),    
          @MonthNo int,    
          @YearNo int    
    
 AS    
    
  SET NOCOUNT ON    
  BEGIN     
    select sum(otduration) as OTMintus,sum(Presentvalue) as Present,sum(absentvalue) as Absent,    
    sum(Wo_Value) as Weekoff,sum(Holiday_Value) as Holiday,sum(LeaveAmount) as Leave    
     from Tran_Attendance where empid =@EmpId and month(dateoffice)=@MonthNo and year(dateoffice) =@YearNo    
      
  END    
  SET NOCOUNT OFF    
    
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_SalaryDetailforProcessAll]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[Select_Mst_SalaryDetailforProcessAll]  
/*  
     Create by : Yogendra Singh  
    Create Date : May 23 2011  
    Modify Date : May 23 2011   
    Notes : Select_Mst_User_All  
*/  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
   select b.*,c.shiftduration from Mst_Employee a,dbo.Mst_SalaryDetail b,Mst_Shift C  
      where a.active=1 and a.EmpId=b.Empid and a.shiftid=c.shiftid order by a.empcode  
  
    
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_SearchEmployee_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Select_Mst_SearchEmployee_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Select_Mst_Employee_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [Empcode][EmpName],[FatherName],[CardNo],[Dept_Name]
		 FROM [Mst_Employee] a,[mst_DEpartment] b
		where a.[DeptId]=b.[DeptId] Order by [Empcode]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Section]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Section]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Section
*/

          @SectionId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [SectionId],[Section_Name],[Section_Description] FROM [Mst_Section]  WHERE   [SectionId] = @SectionId ORDER BY [SectionId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Section_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Section_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Section_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [SectionId],[Section_Name],[Section_Description]  FROM [Mst_Section]  Order by [SectionId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Section_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Section_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Section_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [SectionId],[Section_Name]  FROM [Mst_Section]  Order by [Section_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Section_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Section_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Section_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [Section_Name],[Section_Description]  FROM [Mst_Section]  Order by [Section_Name]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_SerchLeave_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_SerchLeave_All]
    @EmpCode Nvarchar(10)
AS
      
		SET NOCOUNT ON
		BEGIN 
        
select b.EmpCode,b.EmpName,a.Fromdate,a.Todate,c.Dept_Name,a.ApprovedStatus,a.ApprovedDate,a.Remark
From Mst_LeaveApplication a,Mst_Employee b,Mst_Department c where a.empid=b.empid and b.deptid=c.deptid and    a.EmpId=(select Distinct Empid from mst_employee where empcode=@EmpCode)

		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Shift]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Shift] 
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Shift
*/

          @ShiftId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [ShiftId],[ShiftCode],[ShiftName],dbo.FmtTime([StartTime]) as [StartTime],dbo.FmtTime([EndTime]) as [EndTime],dbo.FmtTime([ShiftDuration]) as [ShiftDuration],
			dbo.FmtTime([Break1Begun]) as [Break1Begun],dbo.FmtTime([Break1End]) as [Break1End],dbo.FmtTime([Break1Duration]) as [Break1Duration],dbo.FmtTime([Break2Begun]) as [Break2Begun],
			dbo.FmtTime([Break2End]) as [Break2End],dbo.FmtTime([Break2Duration]) as [Break2Duration],
dbo.FmtTime(LunchBegun) as LunchBegun, dbo.FmtTime(LunchEnd) as LunchEnd,dbo.FmtTime(LunchDur) as LunchDur
			FROM [Mst_Shift]  WHERE   [ShiftId] = @ShiftId ORDER BY [ShiftId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Shift_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Shift_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Shift_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [ShiftId],[ShiftCode],[ShiftName],dbo.FmtTime([StartTime]) as [StartTime],dbo.FmtTime([EndTime]) as [EndTime],dbo.FmtTime([ShiftDuration]) as [ShiftDuration]  FROM [Mst_Shift]  Order by [ShiftId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Shift_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Shift_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Shift_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 
--      
			SELECT   [ShiftId],[ShiftCode]  FROM [Mst_Shift]  Order by [ShiftCode]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Shift_List_forHDay]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Select_Mst_Shift_List_forHDay]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Shift_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 
            select 0 as ShiftId, 'None' as ShiftCode
union all
			SELECT  [ShiftId],[ShiftCode]  FROM [Mst_Shift]  Order by [ShiftCode]
		
		END
		SET NOCOUNT OFF

		RETURN




Select * from IIWOtype


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Shift_List1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Shift_List1]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Shift_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [ShiftId],ltrim(rtrim([ShiftCode])) + ' : ' + ltrim(rtrim(dbo.FmtTime([StartTime]))) + '-'+ltrim(rtrim(dbo.FmtTime([EndTime]))) as [ShiftCode]  FROM [Mst_Shift]  Order by [ShiftCode]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Shift_List2]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Select_Mst_Shift_List2]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_Shift_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 
			SELECT 0 as [ShiftId],'None' as [ShiftCode]
			union all 
			SELECT [ShiftId],[ShiftCode]  FROM [Mst_Shift]  Order by [ShiftId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_Shift_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_Shift_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_Shift_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [ShiftCode],[ShiftName],dbo.FmtTime([StartTime]) as [StartTime],dbo.FmtTime([EndTime]) as [EndTime],
			dbo.FmtTime([ShiftDuration]) as [ShiftDuration],dbo.FmtTime([Break1Begun]) as [Break1Begun],
			dbo.FmtTime([Break1End]) as [Break1End],dbo.FmtTime([Break1Duration]) as [Break1Duration],
			dbo.FmtTime([Break2Begun]) as [Break1Duration],dbo.FmtTime([Break2End]) as [Break2End],
			dbo.FmtTime([Break2Duration])  as [Break2Duration] 
			FROM [Mst_Shift]  Order by [ShiftName]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_User]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_User]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_User
*/

          @User_Id int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [User_Id],[User_Login_Id],[User_Name],[User_Password],[Parent_User_Id],[User_Enabled],[email],[Mobile],[per] FROM [Mst_User]  WHERE   [User_Id] = @User_Id ORDER BY [User_Id]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_User_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_Mst_User_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: May 23 2011
	   Modify Date	: May 23 2011 
	   Notes	: Select_Mst_User_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [User_Id],[User_Login_Id],[User_Name],[User_Password],[User_Enabled],[email],[Mobile],[per]  FROM [Mst_User]  Order by [User_Login_Id]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_User_List]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_User_List]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Select_Mst_User_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [User_Id],[User_Login_Id]  FROM [Mst_User]  Order by [User_Login_Id]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_User_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Mst_User_Print]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 04 2012
	   Modify Date	: Apr 04 2012 
	   Notes	: Select_Mst_User_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [User_Login_Id],[User_Name],[Parent_User_Id],[User_Enabled],[email],[Mobile]  FROM [Mst_User]  Order by [User_Login_Id]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Mst_ValidateUser]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[Select_Mst_ValidateUser]

@LoginId Nvarchar(20),
@LoginPassword Nvarchar(20)

as 

select * from Mst_User where User_Login_Id =@LoginId and User_Password =@LoginPassword


GO
/****** Object:  StoredProcedure [dbo].[Select_sharad]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Procedure [dbo].[Select_sharad]
as
Begin

sELECT * FROM Tran_Attendance

end


GO
/****** Object:  StoredProcedure [dbo].[Select_ShifttypeList]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Select_ShifttypeList]

as 

begin
select *From ShiftType


end


GO
/****** Object:  StoredProcedure [dbo].[Select_SPDetails]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_SPDetails]   
	/*
 	   Create by	: Yogendra Singh
	   Create Date	:
	   Modify Date	:  
	   Notes	:  	: Return SP Parameter ,Datatype,Length,Return Type For a Procedure
			:  
	*/
	@SP_Name			NVARCHAR(100)
	AS
	SET NOCOUNT ON
	--******************************
	SELECT A.name as ObjectName,''  ColName,''  as Data_Type,0 as Length ,0 AS ISOUTPARAM,0 AS colorder 
	FROM Sysobjects a
	WHERE  A.XTYPE ='P' AND A.NAME  =@SP_Name  AND (SELECT COUNT(A.name) AS CNT FROM Sysobjects a,syscolumns b,systypes c WHERE A.ID=B.ID and   b.xtype=c.xtype AND A.XTYPE ='P' AND A.NAME =@SP_Name )=0
	UNION
	SELECT A.name as ObjectName,b.name as ColName,replace(c.name,'Numeric','Decimal')  as Data_Type,B.length as Length ,B.ISOUTPARAM,b.colorder 
	FROM Sysobjects a,syscolumns b,systypes c
	WHERE A.ID=B.ID and   b.xtype=c.xtype AND A.XTYPE ='P' AND A.NAME  =@SP_Name
	ORDER BY colorder	
	
	SET NOCOUNT OFF


GO
/****** Object:  StoredProcedure [dbo].[Select_Table_Details_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Select_Table_Details_All]

	@TableName		NVARCHAR(50)
	AS

	CREATE TABLE #TMPREC
	(
	ColName		Nvarchar(100),
	DateType	Nvarchar(30),
	DateType1	NVarchar(35),
	Collength	Nvarchar(5),
	Xprec		Nvarchar(5),
	Xscale		Nvarchar(5),
	Colorder		int,
	sellist		int,
	orderlist		int,
	ord		int,
	hdatatype	Nvarchar(30),
	mdatatype	Nvarchar(100)

	)



	INSERT INTO  #TMPREC (ColName,DateType,DateType1,Collength,Xprec,Xscale,Colorder)
	SELECT b.name as ColName,c.name  as Data_Type,c.name  ,B.length as Length ,B.XPREC,B.XSCALE,b.colorder 
	FROM Sysobjects a,syscolumns b,systypes c
	WHERE A.ID=B.ID and   b.xtype=c.xtype AND A.XTYPE ='U' AND A.NAME  =@TableName ORDER BY b.colorder	

	UPDATE #TMPREC SET DateType1=LTRIM(RTRIM(DateType))+'('+LTRIM(RTRIM(Xprec))+','+LTRIM(RTRIM(Xscale))+')'
	WHERE DateType in ('decimal','numeric')

	UPDATE #TMPREC SET DateType1=LTRIM(RTRIM(DateType))+'('+LTRIM(RTRIM(collength))+')'
	WHERE DateType in ('Nchar','Nvarchar','nvarchar')
	
	update #TMPREC  set hdatatype ='DateTime' where  DateType in ('smalldatetime','datetime')
	update #TMPREC  set hdatatype ='bool' where  DateType in ('bit')
	update #TMPREC  set hdatatype ='decimal' where  DateType in ('decimal','numeric')
	update #TMPREC  set hdatatype ='string' where  DateType in ('Nchar','Nvarchar','nvarchar')
	update #TMPREC  set hdatatype ='int' where  DateType in ('smallint','int','tinyint')

	update #TMPREC  set hdatatype ='DateTime' where  DateType in ('smalldatetime','datetime')
	update #TMPREC  set hdatatype ='bool' where  DateType in ('bit')
	update #TMPREC  set hdatatype ='decimal' where  DateType in ('decimal','numeric')
	update #TMPREC  set hdatatype ='string' where  DateType in ('Nchar','Nvarchar','nvarchar')
	update #TMPREC  set hdatatype ='int' where  DateType in ('smallint','int','tinyint')

	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.DateTime'+','+ltrim(rtrim(Collength)) +'),' where  DateType in ('datetime')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.SmallDateTime' +','+ltrim(rtrim(Collength))+'),'  where  DateType in ('smalldatetime')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.Bit'+','+ltrim(rtrim(Collength))+'),'  where  DateType in ('bit')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.Decimal' +','+ltrim(rtrim(Collength)) +'),' where  DateType in ('decimal','numeric')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.NChar'  +','+ltrim(rtrim(Collength)) +'),' where  DateType in ('Nchar')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('++'"@'+ltrim(rtrim(colname)) +'", SqlDbType.NVarChar' +','+ltrim(rtrim(Collength))+'),'  where  DateType in ('Nvarchar')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.NVarChar' +','+ltrim(rtrim(Collength))+'),'  where  DateType in ('nvarchar')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.Int' +','+ltrim(rtrim(Collength)) +'),' where  DateType in ('int')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.SmallInt'+','+ltrim(rtrim(Collength))+'),'  where  DateType in ('smallint')
	update #TMPREC  set mdatatype ='Database.MakeInParameter('+'"@'+ltrim(rtrim(colname)) +'", SqlDbType.TinyInt' +','+ltrim(rtrim(Collength)) +'),'where  DateType in ('tinyint')


	

	SELECT ColName,DateType,DateType1,sellist,orderlist,ord,hdatatype,mdatatype  from   #TMPREC order by Colorder


	DROP TABLE #TMPREC


GO
/****** Object:  StoredProcedure [dbo].[Select_TDSReport_Print]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   Proc [dbo].[Select_TDSReport_Print]      
(@fYear int,@TYear int)      
as      
Begin      
Select t.Empid,e.EmpName,e.EmpCode,e.CardNo,s.pfno,s.EsiNo,      
convert(Nchar(10),e.DateOfJoin,103) as DateOfJoin ,'' as PanCardNo, 
d1.Dept_Name,d2.Desig_Name,      
c.CompanyName  ,c.Address as CompanyAddress,c.Vat_no as CVatNo,      
c.Pf_No as cpfno, c.Reg_no as CRegNo,c.Pan_No as CPanNo,      
(Select sum(NetPay) from  Tran_PaidSalaryDetail where Empid=t.empid ) as NetPay,      
(Select sum(TdsAmt) from  Tran_PaidSalaryDetail where Empid=t.empid) as NetPay,      
'e' as e1,'e' as e2,'e' as e3,'e' as e4,'e' as e5,'e' as e6,'e' as e7,      
'e' as e8,'e' as e9,'e' as e10,'e' as e11      
      
from  Tran_PaidSalaryDetail t,Mst_Company c, Mst_Employee e, Mst_Department d1,       
Mst_Designation d2,temp_empid t1   ,Mst_SalaryDetail s   
Where t.empid=e.empid  and d1.deptid=e.deptid and d2.DesigId=e.DesigId      
and e.companyId=c.companyId and       s.empid=e.empid  and 
e.empid =t1.empid   and   yearno between @fYear and   @TYear     
      
End


GO
/****** Object:  StoredProcedure [dbo].[Select_Total_Lunch_DinnerPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE       Proc [dbo].[Select_Total_Lunch_DinnerPrint]        
                    
(                    
@FDate DateTime,                    
@ToDate DateTime  
)
as
Begin
 drop table temp_lunch_Dinner

select convert(Nchar(10),DateOffice,101) as DateOffice,e.EmpId,convert(Nchar(5),Break1in,108) as Break1IN,
convert(Nchar(5),Break2in,108) as Break2in,b1.Branch_Name into temp_lunch_Dinner from BreakDetails B ,MSt_Employee E,Mst_Branch b1 

Where convert(Nchar(10),DateOffice,112)     
between @FDate and  @ToDate    And b.Empid=e.Empid and e.BranchId=b1.BranchId  





select sum(case Break1in when '00:00'  then 0 else 1 End) as TotalLunch,sum(case Break2in when '00:00'  then 0 else 1 End) as TotalDinner,
 DateOffice,Branch_Name as temp1 ,convert(Nchar(10),@FDate,103) as  date,convert(Nchar(10),@ToDate,103) as Todate
  from temp_lunch_Dinner Where convert(Nchar(10),DateOffice,112)     
between  @FDate    and   @ToDate   Group BY Branch_NAme,DateOffice Order by  DateOffice,Branch_name


End


GO
/****** Object:  StoredProcedure [dbo].[Select_Total_Lunch_DinnerPrint1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create      Proc [dbo].[Select_Total_Lunch_DinnerPrint1]           
                    
(                    
@FDate DateTime,                    
@ToDate DateTime                    
)                    
as                    
begin              
    
update  BreakDetails set dateoffice=convert(Nchar(10),dateoffice,101) where  dateoffice=dateoffice    
    drop table temp_lunch_Dinner
          
Select  convert(Nchar(10),DateOffice ,101) as DateOffice  ,       
 (select COunt(Empid) from  BreakDetails  where               
 DateOffice=e.DateOffice  And convert(Nchar(5),Break1in,108)<>'00:00'       
 ) as TotalLunch ,        
        
(select count(Empid) from  BreakDetails where               
 DateOffice=e.DateOffice    And convert(Nchar(5),Break2in,108)<>'00:00'       
 )     
 as TotalDinner ,convert(Nchar(10),@FDate,103) as  date,convert(Nchar(10),@ToDate,103) as Todate     into temp_lunch_Dinner  
from  BreakDetails e where  convert(Nchar(10),DateOffice,112)     
between @FDate and  @ToDate     
 Group  by dateoffice  
  


        
        
 End


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_Attendance_ByDateAndEmpcode]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_Tran_Attendance_ByDateAndEmpcode]  
/*  
     Create by : Sharad Baliyan
    Create Date : Dec 16 2012 
    Modify Date :  Dec 16 2012 
    Notes : Select_Tran_MachineRawPunch  
*/  
  
          @EmpId int,@ByDate smalldatetime  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
   Select Empid, CONVERT(Nvarchar(20), [DateOffice], 103) as OfficeDate,[Status],[SHIFTATTENDED],[LATEARRIVAL],  
   CONVERT(Nvarchar(20), [in1], 103) as In1_Date,CONVERT(Nvarchar(20), [in1], 108) as In1_Time,[In2] as In2Date,CONVERT(Nvarchar(20), [In2], 108) as In2_Time,CONVERT(Nvarchar(20), [out1], 103) as Out1_Date ,CONVERT(Nvarchar(20), [out1], 108) as Out1_Time,  
CONVERT(Nvarchar(20), [out2], 103)  as Out2_Date,CONVERT(Nvarchar(20), [out2], 108) as Out2_Time   
   from Tran_Attendance where  Empid=@EmpId and convert(Nchar(8),[DateOffice],112) between convert(Nchar(8),@ByDate,112)  and convert(Nchar(8),@ByDate,112)
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_MachineRawPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Tran_MachineRawPunch]
/*
 	   Create by	: Raj kumar
	   Create Date	: Dec 16 2010
	   Modify Date	: Dec 16 2010 
	   Notes	: Select_Tran_MachineRawPunch
*/

          @Tran_MachineRawPunchId int
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [PunchDatetime],[CardNo],[P_Day],[ISManual],[PayCode],CONVERT(NVARCHAR(8),PunchDatetime,108) AS Punchtime FROM [Tran_MachineRawPunch] 
  WHERE   [Tran_MachineRawPunchId] = @Tran_MachineRawPunchId ORDER BY [PunchDatetime]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_MachineRawPunch_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Tran_MachineRawPunch_All]
/*
 	   Create by	: Raj Kumar
	   Create Date	: Dec 16 2010
	   Modify Date	: Dec 16 2010 
	   Notes	: Select_Tran_MachineRawPunch_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT a.[Tran_MachineRawPunchId], b.[Empname] as EmployeeName,a.[CardNo],a.[PayCode],a.[PunchDatetime],convert(Nvarchar(20),a.[PunchDatetime],108) as PunchTime,a.[P_Day],a.[ISManual]  FROM [Tran_MachineRawPunch] a inner join Mst_Employee  b on a.[Paycode]=b.empcode ORDER BY a.[PunchDatetime]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_MachineRawPunchByDate]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Tran_MachineRawPunchByDate] 
/*
 	   Create by	: Raj kumar
	   Create Date	: Dec 16 2010
	   Modify Date	: Dec 16 2010 
	   Notes	: Select_Tran_MachineRawPunch
*/

          @Cardno Nvarchar(50),@ByDate smalldatetime
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT CONVERT(Nvarchar(20), PunchDatetime, 101) as PunchDatetime,Tran_Machinerawpunchid,[CardNo],[P_Day],[ISManual],[PayCode],CONVERT(NVARCHAR(8),PunchDatetime,108) AS Punchtime FROM [Tran_MachineRawPunch] 
  WHERE   [CardNo] =  @Cardno and [PunchDateTime]>=@ByDate ORDER BY [PunchDatetime]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_MachineSetup]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Tran_MachineSetup]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 18 2012
	   Modify Date	: Apr 18 2012 
	   Notes	: Select_Tran_MachineSetup
*/

          @MCSetupId int

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [MCSetupId],[McTypeId],[TypeName],[PortNo],[MCNo],[IPAddress] FROM [Tran_MachineSetup]  WHERE   [MCSetupId] = @MCSetupId ORDER BY [MCSetupId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_MachineSetup_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_Tran_MachineSetup_All]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 18 2012
	   Modify Date	: Apr 18 2012 
	   Notes	: Select_Tran_MachineSetup_All
*/
	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [MCSetupId],[TypeName],[PortNo],[MCNo],[IPAddress]  FROM [Tran_MachineSetup]  Order by [MCSetupId]
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_PaidSalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_Tran_PaidSalaryDetail]  
/*  
     Create by : Yogendra Singh  
    Create Date : Aug 20 2012  
    Modify Date : Aug 20 2012   
    Notes : Select_Tran_PaidSalaryDetail  
*/  
  
          @EmpId numeric(18,0),  
          @MonthNo int,  
          @YearNo int  
  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
   SELECT [EmpId],[MonthNo],[YearNo],[MonthDay],[Present],[Absent],[WeeklyOff],[Holidays],[PaidLeave],[PayDays],[Addtion1_Rate],[Addition2_Rate],[Addition3_Rate],[Addition4_Rate],[Addition5_Rate],[Addition1_Paid],[Addition2_Paid],[Addition3_Paid],[Addition4_Paid],[Addition5_Paid],[PF_Ded],[EPF_Ded],[ESI_Ded],[Ded1_Ded],[Ded3_Ded],[Ded2_Ded],[OTHours],[OTRate],[OTAmount],[Tota_Earning],[Total_Ded],[NetPay] FROM [Tran_PaidSalaryDetail]  WHERE   [EmpId] = @EmpId And [MonthNo] = @MonthNo And [YearNo] = @YearNo
    
    
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_PaidSalaryDetailPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_Tran_PaidSalaryDetailPrint]  
/*  
     Create by : Yogendra Singh  
    Create Date : Aug 11 2012  
    Modify Date : Aug 11 2012   
    Notes : Select_Tran_PaidSalaryDetail  
*/  
  
          @MonthNo int,  
          @YearNo int  
  
 AS  
  
  SET NOCOUNT ON  
  BEGIN   
  
   SELECT a.empid,a.empname,fathername,empcode,desig_name,dept_name,e.pfno,e.esino,f.companyname,  
   [MonthNo],[YearNo],[MonthDay],[Present],[Absent],[WeeklyOff],[Holidays],[PaidLeave],[PayDays],[Addtion1_Rate] as Basic_Rate,[Addition2_Rate] as HRA_Rate,[Addition3_Rate] as Da_Rate,[Addition4_Rate] as Misc_Rate,[Addition1_Paid] as Basic_Paid,[Addition2_Paid] as Hra_Paid  
,[Addition3_Paid] as Da_Paid,[Addition1_Paid] as Misc_Paid,[Ded1_Ded] as Advance_Ded,[PF_Ded],[EPF_Ded],[ESI_Ded],[Ded2_Ded] as LIC_Ded ,[Ded3_Ded] as ITAX_Ded ,[OTHours],b.[OTRate],[OTAmount],[Tota_Earning],[Total_Ded],[NetPay]   
   FROM Mst_Employee a,[Tran_PaidSalaryDetail] b,Mst_Designation c,Mst_Department d,Mst_SalaryDetail e ,Mst_company f  
   WHERE   a.desigid=c.desigid and a.deptid=d.deptid  and a.empid=b.empid and a.empid=e.empid and a.companyid=f.companyid  
   and [MonthNo] = @MonthNo And [YearNo] = @YearNo order by a.empcode  
  
  END  
  SET NOCOUNT OFF  
  
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_PaidSalaryDetailPrint1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE    PROCEDURE [dbo].[Select_Tran_PaidSalaryDetailPrint1]     
/*        
     Create by : Sharad Baliyan
    Create Date : Aug 11 2012        
    Modify Date : Aug 11 2012         
    Notes : Select_Tran_PaidSalaryDetail        
*/        
        
          @MonthNo int,        
          @YearNo int        
        
 AS        
        
  SET NOCOUNT ON        
  BEGIN         
        
   SELECT a.empid,a.empname,fathername,empcode,desig_name,dept_name,e.pfno,e.esino,f.companyname,        
   [MonthNo],[YearNo],[MonthDay],[Present],[Absent],[WeeklyOff],[Holidays],[PaidLeave],[PayDays],[Addtion1_Rate]     
,[Addition2_Rate] ,[Addition3_Rate] ,[Addition4_Rate],[Addition5_Rate] ,[Addition6_Rate],[Addition7_Rate],    
[Addition8_Rate],[Addition9_Rate],[Addition10_Rate] ,   
  Addition1_paid as [Addition1_Paid] ,[Addition2_Paid] ,[Addition3_Paid] ,[Addition4_Paid] , Addition5_Paid ,Addition6_Paid ,Addition7_Paid ,    
Addition8_Paid ,Addition9_Paid ,Addition10_Paid ,[PF_Ded],[EPF_Ded],[ESI_Ded], [PPF_Ded],    
[Ded1_Rate] ,[Ded2_Rate] ,[Ded3_Rate] ,[Ded4_Rate],[Ded5_Rate],[Ded1_Ded] ,[Ded2_Ded] ,[Ded3_Ded] ,[Ded4_Ded],[Ded5_Ded] ,    
b.FDed1,b.FDed2,b.FDed3,b.FDed4,b.FDed5    
,[OTHours],b.[OTRate],[OTAmount],[Tota_Earning],[Total_Ded],[NetPay] , AmtInWord ,      
f.Addition1,f.Addition2,f.Addition3,f.Addition4,f.Addition5,f.Addition6,f.Addition7,f.Addition8,f.Addition9,f.Addition10,    
f.Ded1,f.Ded2,f.Ded3, f.Ded4,f.Ded5 ,F.FDed1,F.FDed2,F.FDed3,F.FDed4,F.FDed5,TdsAmountVal,TdsRate,b.TdsAmt,    
    
'e'as c1 ,'e' as c2,'s' as c3,'s' as c4,'e' as c5,'c' as c6,'c' as c7  ,'c' as c8,'c' as c9, 'c' as c10, b.Loanname as c11,    
'c' as c12, 'c' as c13  ,convert(Nchar(10),getdate(),103) as c14    
   FROM dbo.Mst_Employee a,dbo.Tran_PaidSalaryDetail b,dbo.Mst_Designation c,dbo.Mst_Department d,dbo.Mst_SalaryDetail e ,dbo.Mst_company f ,dbo.temp_empid  te     
   WHERE   a.desigid=c.desigid and a.deptid=d.deptid  and a.empid=b.empid and a.empid=e.empid and a.companyid=f.companyid  and a.empid=  te.empid    
   and [MonthNo] = @MonthNo And [YearNo] = @YearNo order by a.empcode        
        
  END        
  SET NOCOUNT OFF        
        
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_Tran_TDS_DetailPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Select_Tran_TDS_DetailPrint]   
/*        
     Create by : Sharad Baliyan        
            
    Notes : Select_Tran_PaidSalaryDetail        
*/        
        
          @MonthNo int,        
          @YearNo int        
        
 AS        
        
  SET NOCOUNT ON        
  BEGIN         
        
   SELECT a.empid,a.empname,fathername,empcode,desig_name,dept_name,e.pfno,e.esino,f.nickname,        
   [Month],[Year],[MonthDay],[Present],[Absent],[PaidLeave],[Weekoff],[Holiday],[PaidDays],[TotalWorkHrs]      
 ,[OTHrs] ,b.[OtRate] ,[Pf_Ded],[Esi_Ded] ,[Epf_Ded] ,[AHead1_Rate]         
,[AHead2_Rate] ,[AHead3_Rate] ,[AHead4_Rate]  ,AHead5_Rate,AHead6_Rate ,AHead7_Rate,      
AHead8_Rate,AHead9_Rate,AHead1_Paid,AHead2_Paid,AHead3_Paid,AHead4_Paid,AHead5_Paid,AHead6_Paid,      
AHead7_Paid,AHead8_Paid,AHead9_Paid,FDed1_Amt,FDed2_Amt,FDed3_Amt,FDed4_Amt,FDed5_Amt,      
ODed1_Rate,ODed2_Rate,ODed3_Rate,ODed4_Rate,ODed5_Rate,ODed6_Rate,ODed7_Rate,ODed8_Rate,      
ODed1_Amt,ODed2_Amt,ODed3_Amt,ODed4_Amt,ODed5_Amt,ODed6_Amt,ODed7_Amt,ODed8_Amt,      
OtAmount,Tota_Earning,Total_Ded,NetPay,AdditionHead1,AdditionHead2,AdditionHead3,AdditionHead4,      
AdditionHead5,AdditionHead6,AdditionHead7,AdditionHead8,AdditionHead9,      
FDedHead1,FDedHead2,FDedHead3,FDedHead4,FDedHead5,ODedHead1,ODedHead2,ODedHead3,ODedHead4,ODedHead5,      
ODedHead6,ODedHead7,ODedHead8,      
      
'Rs Solution'as c1 ,AmountInWord as c2,AmountInWordWothOt as c3,'s' as c4,'e' as c5,'c' as c6,'c' as c7        
      
   FROM Mst_Employee a,[Tran_PaidSalaryDetail] b,mst_desig c,Mst_Dept d,Mst_SalaryDetails e ,Mst_company f  ,Mst_CompanyPaySetup f1,temp_empid t      
   WHERE   a.desigid=c.desigid and a.deptid=d.deptid  and a.empid=b.empid and a.empid=e.empid and a.companyid=f.companyid  and f.companyid=f1.companyId      
and a.empid=t.empid      
   and [Month] = @MonthNo And [Year] = @YearNo order by a.empcode        
        
  END        
  SET NOCOUNT OFF        
        
  RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_UserTables_All]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Select_UserTables_All]

	AS


Select TABLE_NAME, TABLE_NAME tname FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE ='BASE TABLE' ORDER BY TABLE_NAME


GO
/****** Object:  StoredProcedure [dbo].[Select_ValidatePassword]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Select_ValidatePassword]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Feb 04 2012
	   Modify Date	: Feb 04 2012 
	   Notes	: Select_Mst_User
*/

          @UserId int,
          @Password Nvarchar(50)

	AS

		SET NOCOUNT ON
		BEGIN 

			SELECT [User_Login_Id],[User_Name],[User_Password] FROM [Mst_User]  WHERE   [User_Id] = @UserId And [User_Password] = @Password  
		
		END
		SET NOCOUNT OFF

		RETURN


GO
/****** Object:  StoredProcedure [dbo].[Select_weekdayNamesList]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create Procedure [dbo].[Select_weekdayNamesList]
as

Begin

select 1 as DayId,'Sunday' as DayName
union all
select 2 as DayId,'Monday' as DayName
union all
select 3 as DayId,'Tuesday' as DayName 
union all
select 4 as DayId,'Wednesday' as DayName
union all
select 5 as DayId,'Thrusday' as DayName
union all
select 6 as DayId,'Friday' as DayName 
union all
select 7 as DayId,'Saturday' as DayName
union all
select 8 as DayId,'None' as DayName order by DayId



End


GO
/****** Object:  StoredProcedure [dbo].[Select_weekdaysList]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Select_weekdaysList]
as

Begin

select 0 as WeekNo,'Sunday' as WeekName
union all
select 1 as WeekNo,'Monday' as WeekName
union all
select 2  as WeekNo,'Tuesday' as WeekName 
union all
select 3 as WeekNo,'Wednesday' as WeekName
union all
select 4 as WeekNo,'Thrusday' as WeekName
union all
select 5 as WeekNo,'Friday' as WeekName 
union all
select 6 as WeekNo,'Saturday' as WeekName  order by WeekNo 

end


GO
/****** Object:  StoredProcedure [dbo].[Select_YearlyAbsentReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_YearlyAbsentReport]  
@Year smalldatetime 


as

begin

IF OBJECT_ID('dbo.[yearlyAbsent','U') IS  NULL 
DROP TABLE dbo.[yearlyAbsent]

 select datename(mm,t.DateOffice) as month,
	count(t.Absentvalue) as TotalAbsent,t.Empid,(select empname from mst_Employee e where  e.empid=t.empid )as EmpName 
into dbo.yearlyAbsent from 
	Tran_Attendance t,mst_employee e  where t.empid=e.empid and year(t.DateOffice)=year(@Year) and t.status='A'
group by
	year(t.DateOffice),
	month(t.DateOffice),
	datename(mm,t.DateOffice),t.empid
order by 
	year(t.DateOffice),
	month(t.DateOffice),
	datename(mm,t.DateOffice)
exec  Select_YearlyAbsentReportPrint

end


GO
/****** Object:  StoredProcedure [dbo].[Select_YearlyAbsentReportPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create  Procedure [dbo].[Select_YearlyAbsentReportPrint]
as 
Select a.month,a.Empid,a.empname,d.dept_name,c.Companyname,a.TotalAbsent from yearlyAbsent  a,mst_Employee e ,mst_department d,mst_Company c where e.empid=a.empid and e.deptid=d.deptid and e.Companyid=c.Companyid


GO
/****** Object:  StoredProcedure [dbo].[Select_YearlyLeaveBal]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Procedure [dbo].[Select_YearlyLeaveBal]

@year int 

as 
begin

	select empcode,empname,convert(Nchar(10),dateofjoin,103) as dtjoin,dept_name,desig_name,
	isnull((select sum(opening) from mst_leaveopening where empid=a.empid and leavetypeid=d.leavetypeid
	 and  yearno=@year and empid=a.empid ),0) as opening,
	isnull((select sum(leavevalue) from Tran_attendance where empid=a.empid and  year(dateoffice)=@year
	and leavecode=d.ltypecode),0) as totleave,d.ltypecode as leavename,'' as c1,'' as c2,'' as c3
	from mst_employee a,mst_department b,mst_designation c,mst_LeaveType d,Temp_EmpId e
	where a.deptid=b.deptid and a.desigid=c.desigid and a.empid=e.empid
end


GO
/****** Object:  StoredProcedure [dbo].[Select_YearlyPresentReport]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  procedure [dbo].[Select_YearlyPresentReport] 
@year datetime

as

begin
IF OBJECT_ID('dbo.[yearlyPersent','U') IS  NULL 
DROP TABLE dbo.[yearlyPersent]
select

	datename(mm,t.DateOffice) as month,
	count(t.Presentvalue) as TotalPresent,t.Empid,(select empname from mst_Employee e where  e.empid=t.empid )as EmpName into dbo.yearlyPersent
from 
	Tran_Attendance t,mst_employee e  where t.empid=e.empid and year(t.DateOffice)=year(@Year) and t.status='P'
group by
	year(t.DateOffice),
	month(t.DateOffice),
	datename(mm,t.DateOffice),t.empid
order by 
	
	month(t.DateOffice)
	
Exec Select_YearlyPresentReportPrint

end


GO
/****** Object:  StoredProcedure [dbo].[Select_YearlyPresentReportPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Procedure [dbo].[Select_YearlyPresentReportPrint]
as

Select a.month,a.Empid,a.empname,d.dept_name,c.Companyname,a.TotalPresent from yearlyPersent  a,mst_Employee e ,mst_department d,mst_Company c where e.empid=a.empid and e.deptid=d.deptid and e.Companyid=c.Companyid order By Empid


GO
/****** Object:  StoredProcedure [dbo].[SelectMachinerawData]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create proc [dbo].[SelectMachinerawData]
@fordate smalldatetime,
@todate smalldatetime = @fordate
as
begin
select e.empcode,e.empname,e.cardno,convert(Nvarchar,ta.punchdatetime,103) as [Punch Date],convert(Nvarchar(5),ta.punchdatetime,108) as [PunchTimeRemarks],
'Punch Time'=case  when ta.isManual='y' then convert(Nvarchar(5),ta.punchdatetime,108)+' M'
else  convert(Nvarchar(5),ta.punchdatetime,108)
end
,max(@fordate) as [Fordate],max(@todate) as [Todate]
from mst_employee e,tran_machinerawpunch ta,Temp_empid te  where  e.cardno=ta.cardno and e.empid=te.empid and convert(Nvarchar,ta.punchdatetime,112)  between convert(Nvarchar,@fordate,112)  and convert(Nvarchar,@todate,112) 
group by e.empcode,e.empname,e.cardno,ta.punchdatetime,ta.isManual order by e.empcode,ta.punchdatetime
end


GO
/****** Object:  StoredProcedure [dbo].[sharad]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE     procedure [dbo].[sharad]   
@fordate smalldatetime,  
@ToDate smalldatetime  ,
@Empid  int
as  
begin  
 select RowId,Shift,convert(Nchar(10),DateOffice,103) as DateOffice from   Tran_Attendance   
where convert(Nvarchar,dateoffice,112) between convert(Nvarchar,@fordate,112) and convert(Nvarchar,@ToDate,112)   
and   Empid=@Empid order By  dateoffice  
  
end


GO
/****** Object:  StoredProcedure [dbo].[tempmachinepunchPrint]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Proc [dbo].[tempmachinepunchPrint]
as
begin

SELECT Paycode,
SUBSTRING(
(
SELECT ( ', ' + PunchTime)  	
FROM ss t2
WHERE t1.Paycode = t2.Paycode
ORDER BY t1.Paycode, t2.PunchTime
FOR XML PATH('')
), 3, 1000) as PunchTime,t1.empname,Cardno,PunchDate
FROM ss t1
GROUP BY Paycode,empname,Cardno,PunchDate
end


GO
/****** Object:  StoredProcedure [dbo].[TempMachinePunchPrint1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Proc [dbo].[TempMachinePunchPrint1]    
as    
begin    
    
SELECT Paycode,    
SUBSTRING(    
(    
SELECT ( ', ' + PunchTime)       
FROM ss t2    
WHERE t1.Paycode = t2.Paycode   and t1.PunchDate=t2.PunchDate   
ORDER BY t1.Paycode, t2.PunchTime    
FOR XML PATH('')    
), 3, 1000) as PunchTime,t1.empname,Cardno,convert(Nchar(10),PunchDate ,101) as PunchDate  
FROM ss t1    
GROUP BY Paycode,empname,Cardno,PunchDate    
end


GO
/****** Object:  StoredProcedure [dbo].[test]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create  Proc [dbo].[test]
as

begin 
Select
'Empname'  as 'Empname',
'Cardno' as  'Cardno',
'punchdate'  as 'punchdate',
'InGateName' as  'InGateName',
'In' as 'In',
'Out'  as 'Out',

'OutGateName' as  'OutGateName',
'Status' as  'Status',

'fromDate' as 'fromDate' ,
'todate' as 'todate',
'temp1' as temp1

  from mst_user 
 end


GO
/****** Object:  StoredProcedure [dbo].[truncatetables]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[truncatetables]

as
truncate table Map_UserCompany
truncate table misspunch
truncate table Mst_Bank
truncate table Mst_Dates
truncate table Mst_Holiday
truncate table Mst_LeaveApplication
truncate table Mst_LeaveOpening
truncate table Mst_LeaveType
truncate table Mst_SalaryDetail
truncate table Mst_Section
delete from Mst_Shift where shiftcode<>'009'
delete from mst_user  where user_login_id<>'admin'
truncate table Tran_Attendance
truncate table Tran_Daily_Attendance_Temp
truncate table Tran_MachineRawPunch
truncate table Tran_PaidSalaryDetail
truncate table Mst_Branch
truncate table Mst_Employee
truncate table Mst_Department
truncate table Mst_Designation
truncate table Mst_Company


GO
/****** Object:  StoredProcedure [dbo].[Update_All_In_Out_Table]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   Procedure [dbo].[Update_All_In_Out_Table]  
as  
  
Begin   
  
  
update  All_In_Out_Table Set  TotalDur=OutTime-InTime  Where id=id  
  
End


GO
/****** Object:  StoredProcedure [dbo].[Update_defaultvalue]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create procedure [dbo].[Update_defaultvalue]
 as 
begin
update mst_employee set regindate ='',superiourname=1,
shifttype='Fixed',shiftpatternid='',isautoshift=0,auto_shifts='',
firstoffday='Sunday' ,secondoffdaytype='None' ,secondoffday='None',
halfdayshiftid=1,secondweekoffdays='',shiftremaindays=0,cdays=7,
shiftcode='001',halfdayshiftcode='001'    ,imagepath='',
by_user =1,emailaddress=0,bsalary=0,pwd=''
   where pwd is null

end


GO
/****** Object:  StoredProcedure [dbo].[Update_Email_Config]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Email_Config]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Update_Mst_CorpPolicy
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

       @Uname Nvarchar(80),
      @pwd Nvarchar(50),
   @FAddress Nvarchar(150),
   @smtpAddress Nvarchar(120),
   @port Nvarchar(8),
  @Ssl Nvarchar(10),
  @ToAddress Nvarchar(150),
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [mst_Email] ) 	   
			BEGIN
				UPDATE  [mst_Email] 
					SET  Uname=@Uname,pwd=@pwd,FAddress=@FAddress,smptAddress=@smtpAddress,port=@port,Ssl=@Ssl,ToAddress=@ToAddress

			END				
		ELSE
			BEGIN
				INSERT INTO [mst_Email]			
				([Uname],[pwd],[FAddress],[smptAddress],[port],[Ssl],[ToAddress])				
				VALUES				
				(@Uname,@pwd,@FAddress,@smtpAddress,@port,@Ssl,@ToAddress)				

			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Emp_Photo]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Emp_Photo]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Feb 04 2012
	   Modify Date	: Feb 04 2012 
	   Notes	: Update_Mst_User
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/
(
          @Empid Int,
          @imgpath Nvarchar(200)
        )

	 AS 

			BEGIN
				UPDATE  [Mst_Employee] 
					SET [ImagePath]=@imgpath
					WHERE [Empid] = @Empid
			END


GO
/****** Object:  StoredProcedure [dbo].[Update_EmpPassword]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_EmpPassword]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Feb 04 2012
	   Modify Date	: Feb 04 2012 
	   Notes	: Update_Mst_User
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @Password Nvarchar(50),
          @UserId Nvarchar(50),
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		
			BEGIN
				UPDATE  [mst_Employee]
					SET [pwd]=@Password
					WHERE [empcode] = @UserId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Bank]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Bank]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Update_Mst_Bank
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @Bank_Name Nvarchar(50),
          @Bank_Description Nvarchar(100),
          @By_User int,
          @BankID int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Bank] WHERE  [BankID] <> @BankID And [Bank_Name] = @Bank_Name ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Bank] 
					SET [Bank_Name]=@Bank_Name,[Bank_Description]=@Bank_Description,[By_User]=@By_User
					WHERE [BankID] = @BankID
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Branch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Branch]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Update_Mst_Branch
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @Branch_Name Nvarchar(100),
          @Address Nvarchar(200),
          @PhoneNo Nvarchar(100),
          @EmailId Nvarchar(50),
          @By_User int,
          @BranchId int,
          @CompanyId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Branch] WHERE  [BranchId] <> @BranchId And [Branch_Name] = @Branch_Name ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Branch] 
					SET [Branch_Name]=@Branch_Name,[Address]=@Address,[PhoneNo]=@PhoneNo,[EmailId]=@EmailId,[By_User]=@By_User,CompanyId=@CompanyId
					WHERE [BranchId] = @BranchId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Company]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[Update_Mst_Company]      
/*      
     Create by : Yogendra Singh      
    Create Date : Aug 13 2012      
    Modify Date : Aug 13 2012       
    Notes : Update_Mst_Company      
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query      
*/      
      
          @CompanyName Nvarchar(100),      
          @Description Nvarchar(150),      
          @Address Nvarchar(250),      
          @PhoneNo Nvarchar(50),      
          @EmailId Nvarchar(50),      
          @Vat_No Nvarchar(20),      
          @Pf_No Nvarchar(20),      
          @Tan_No Nvarchar(20),      
          @Reg_No Nvarchar(20),      
          @Esi_No Nvarchar(20),      
          @Pan_No Nvarchar(20),      
          @PF numeric(6,2),      
          @FPF numeric(6,2),      
          @ESI numeric(6,2),      
          @Addition1 Nvarchar(30),      
          @Addition2 Nvarchar(30),      
          @Addition3 Nvarchar(30),      
          @Addition4 Nvarchar(30),      
          @Addition5 Nvarchar(30),      
          @Addition6 Nvarchar(30),      
          @Addition7 Nvarchar(30),      
          @Addition8 Nvarchar(30),      
          @Addition9 Nvarchar(30),      
          @Addition10 Nvarchar(30),      
    
          @Ded1 Nvarchar(30),      
          @Ded2 Nvarchar(30),     
          @Ded3 Nvarchar(30),      
          @Ded4 Nvarchar(30),     
          @Ded5 Nvarchar(30),      
    
          @FDed1 Nvarchar(30),      
          @FDed2 Nvarchar(30),     
          @FDed3 Nvarchar(30),      
          @FDed4 Nvarchar(30),     
          @FDed5 Nvarchar(30),     
    
          @CompanyId int,   
          @PPF Decimal(18,2),     
          @STATUS SMALLINT OUTPUT        
      
  AS       
      
 SET NOCOUNT ON      
 DECLARE @ErrorNo INT      
       
Begin try        
       
 SELECT @STATUS=0      
        
 BEGIN TRAN btrnupdt       
      
  IF 0<(SELECT COUNT(*) FROM  [Mst_Company] WHERE  [CompanyId] <> @CompanyId And [CompanyName] = @CompanyName )           
   BEGIN      
    SELECT @STATUS =1      
    SET NOCOUNT OFF      
    COMMIT TRAN btrnupdt      
    RETURN      
   END          
  ELSE      
   BEGIN      
    UPDATE  [Mst_Company]       
     SET [CompanyName]=@CompanyName,[Description]=@Description,[Address]=@Address,[PhoneNo]=@PhoneNo,[EmailId]=@EmailId,[Vat_No]=@Vat_No,[Pf_No]=@Pf_No,[Tan_No]=@Tan_No,[Reg_No]=@Reg_No,[Esi_No]=@Esi_No,[Pan_No]=@Pan_No,[PF]=@PF,[FPF]=@FPF,[ESI]=@ESI,    
[Addition1]=@Addition1,[Addition2]=@Addition2,[Addition3]=@Addition3,[Addition4]=@Addition4,[Addition5]=@Addition5,    
[Addition6]=@Addition6, [Addition7]=@Addition7,[Addition8]=@Addition8,[Addition9]=@Addition9,[Addition10]=@Addition10,    
[Ded1]=@Ded1,[Ded2]=@Ded2,[Ded3]=@Ded3 ,[Ded4]=@Ded4,[Ded5]=@Ded5,FDed1=@FDed1,FDed2=@FDed2,FDed3=@FDed3,    
FDed4=@FDed4,FDed5=@FDed5,PPF=@PPF    
     WHERE [CompanyId] = @CompanyId      
   END      
 COMMIT TRAN btrnupdt      
 RETURN          
      
End try      
      
BEGIN CATCH      
        
 ErrorHandler:      
 SET NOCOUNT OFF      
 SELECT @STATUS =9      
 ROLLBACK TRAN btrnupdt      
 RETURN       
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_CorpPolicy]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_CorpPolicy]  
/*  
     Create by : Yogendra Singh  
    Create Date : Apr 12 2012  
    Modify Date : Apr 12 2012   
    Notes : Update_Mst_CorpPolicy  
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query  
*/  
  
          @DuplidatePunchMin numeric(6,2),  
          @MaxEarlyComming numeric(6,2),  
          @MaxLateGoing numeric(6,2),  
          @MinPresentForWO numeric(6,2),  
          @AWAasAAA bit,  
          @OTFormula int,  
          @WorkHrCalc int,  
          @ShowPayroll Bit,  
          @absentonsinglePunch Bit, 
          @SalCalMode Bit,
          @STATUS SMALLINT OUTPUT    
  
  AS   
  
 SET NOCOUNT ON  
 DECLARE @ErrorNo INT  
   
Begin try    
   
 SELECT @STATUS=0  
    
 BEGIN TRAN btrnupdt   
  
  IF 0<(SELECT COUNT(*) FROM  [Mst_CorpPolicy] )       
   BEGIN  
    UPDATE  [Mst_CorpPolicy]   
     SET [MaxEarlyComming]=@MaxEarlyComming,[MaxLateGoing]=@MaxLateGoing,[MinPresentForWO]=@MinPresentForWO,[AWAasAAA]=@AWAasAAA,[OTFormula]=@OTFormula,[DuplidatePunchMin]=@DuplidatePunchMin,[WorkHrCalc]=@WorkHrCalc,ShowPayroll=@ShowPayroll  ,
absentonsinglePunch=@absentonsinglePunch,SalCalMode=@SalCalMode
  
   END      
  ELSE  
   BEGIN  
    INSERT INTO [Mst_CorpPolicy]     
    ([DuplidatePunchMin],[MaxEarlyComming],[MaxLateGoing],[MinPresentForWO],[AWAasAAA],[OTFormula],[WorkHrCalc],[ShowPayroll],absentonsinglePunch,SalCalMode)      
    VALUES      
    (@DuplidatePunchMin,@MaxEarlyComming,@MaxLateGoing,@MinPresentForWO,@AWAasAAA,@OTFormula,@WorkHrCalc,@ShowPayroll,@absentonsinglePunch,@SalCalMode)      
  
   END  
 COMMIT TRAN btrnupdt  
 RETURN      
  
End try  
  
BEGIN CATCH  
    
 ErrorHandler:  
 SET NOCOUNT OFF  
 SELECT @STATUS =9  
 ROLLBACK TRAN btrnupdt  
 RETURN   
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Department]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Department]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012 
	   Notes	: Update_Mst_Department
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @Dept_Name Nvarchar(100),
          @Dept_Description Nvarchar(150),
          @By_User int,
          @DeptId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Department] WHERE  [DeptId] <> @DeptId And [Dept_Name] = @Dept_Name ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Department] 
					SET [Dept_Name]=@Dept_Name,[Dept_Description]=@Dept_Description,[By_User]=@By_User
					WHERE [DeptId] = @DeptId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Designation]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Designation]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012 
	   Notes	: Update_Mst_Designation
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @Desig_Name Nvarchar(50),
          @Desig_Description Nvarchar(100),
          @By_User int,
          @DesigId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Designation] WHERE  [DesigId] <> @DesigId And [Desig_Name] = @Desig_Name ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Designation] 
					SET [Desig_Name]=@Desig_Name,[Desig_Description]=@Desig_Description,[By_User]=@By_User
					WHERE [DesigId] = @DesigId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Employee]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Employee]
         @EmpName Nvarchar(50),
          @FatherName Nvarchar(50),
          @EmpCode Nvarchar(10),
          @pwd     Nvarchar(50),
          @CardNo Nvarchar(10),
          @CompanyId int,
          @DeptId int,
          @DesigId int,
          @BranchId int,
          @OTimePoliceId int,
          @DateofJoin smalldatetime,
          @ShiftId int,
          @ShiftType Nvarchar(10),
          @ShiftPatternId Nvarchar(50),
          
         
          @SuperiourName int,
          @IsAutoShift bit,
          @Auto_Shifts Nvarchar(50),
          @FirstOffDay Nchar(15),
          @SecondOffDayType Nvarchar(5),
          @SecondOffDay Nchar(15),
          @HalfDayShiftId int,
          @SecondWeekOffDays Nvarchar(20),
          @ShiftRemaindays int,
          @CDays int,
          @ShiftStartDate smalldatetime,
          @ShiftCode Nchar(3),
          @HalfDayShiftCode Nchar(3),
       
          @EmpId int,
          @EmailAddress Nvarchar(150),
          @BSalary numeric(18, 0),
   
          @STATUS SMALLINT OUTPUT

	 AS 



	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Employee] WHERE  [EmpId] <> @EmpId And Empcode= @EmpCode and  Cardno=@CardNo) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Employee] 
					SET [EmpName]=@EmpName,[FatherName]=@FatherName,[EmpCode]=@EmpCode,[CardNo]=@CardNo,[CompanyId]=@CompanyId,[DeptId]=@DeptId,[DesigId]=@DesigId,[BranchId]=@BranchId,[OTimePoliceId]=@OTimePoliceId,[DateofJoin]=@DateofJoin,[ShiftId]=@ShiftId,[SuperiourName]=@SuperiourName,[ShiftType]=@ShiftType,[ShiftPatternId]=@ShiftPatternId,[IsAutoShift]=@IsAutoShift,[Auto_Shifts]=@Auto_Shifts,[FirstOffDay]=@FirstOffDay,[SecondOffDayType]=@SecondOffDayType,[SecondOffDay]=@SecondOffDay,[HalfDayShiftId]=@HalfDayShiftId,[SecondWeekOffDays]=@SecondWeekOffDays,[ShiftRemaindays]=@ShiftRemaindays,[CDays]=@CDays,[ShiftStartDate]=@ShiftStartDate,[ShiftCode]=@ShiftCode,[HalfDayShiftCode]=@HalfDayShiftCode,EmailAddress=@EmailAddress,
                     BSalary=@BSalary
					WHERE [EmpId] = @EmpId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Employee1]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[Update_Mst_Employee1]
         @EmpName Nvarchar(50),
          @FatherName Nvarchar(50),
          @EmpCode Nvarchar(10),
          @pwd     Nvarchar(50),
          @CardNo Nvarchar(10),
          @CompanyId int,
          @DeptId int,
          @DesigId int,
          @BranchId int,
          @OTimePoliceId int,
          @DateofJoin smalldatetime,
          @ShiftId int,
          @ShiftType Nvarchar(10),
          @ShiftPatternId Nvarchar(50),
          
         
          @SuperiourName int,
          @IsAutoShift bit,
          @Auto_Shifts Nvarchar(50),
          @FirstOffDay Nchar(15),
          @SecondOffDayType Nvarchar(5),
          @SecondOffDay Nchar(15),
          @HalfDayShiftId int,
          @SecondWeekOffDays Nvarchar(20),
          @ShiftRemaindays int,
          @CDays int,
          @ShiftStartDate smalldatetime,
          @ShiftCode Nchar(3),
          @HalfDayShiftCode Nchar(3),
       
          @EmpId int,
          @EmailAddress Nvarchar(150),
          @BSalary numeric(18, 0),
          @ReginDate  Nvarchar(12),
          @STATUS SMALLINT OUTPUT

	 AS 



	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Employee] WHERE  [EmpId] <> @EmpId And [EmpName] = @EmpName ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Employee] 
					SET [EmpName]=@EmpName,[FatherName]=@FatherName,[EmpCode]=@EmpCode,[CardNo]=@CardNo,[CompanyId]=@CompanyId,[DeptId]=@DeptId,[DesigId]=@DesigId,[BranchId]=@BranchId,[OTimePoliceId]=@OTimePoliceId,[DateofJoin]=@DateofJoin,[ShiftId]=@ShiftId,[SuperiourName]=@SuperiourName,[ShiftType]=@ShiftType,[ShiftPatternId]=@ShiftPatternId,[IsAutoShift]=@IsAutoShift,[Auto_Shifts]=@Auto_Shifts,[FirstOffDay]=@FirstOffDay,[SecondOffDayType]=@SecondOffDayType,[SecondOffDay]=@SecondOffDay,[HalfDayShiftId]=@HalfDayShiftId,[SecondWeekOffDays]=@SecondWeekOffDays,[ShiftRemaindays]=@ShiftRemaindays,[CDays]=@CDays,[ShiftStartDate]=@ShiftStartDate,[ShiftCode]=@ShiftCode,[HalfDayShiftCode]=@HalfDayShiftCode,EmailAddress=@EmailAddress,
                     BSalary=@BSalary,ReginDate=@ReginDate
					WHERE [EmpId] = @EmpId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_EmploymentType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_EmploymentType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Update_Mst_EmploymentType
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @EmploymentTypeName Nvarchar(50),
          @EmploymentTypeDesc Nvarchar(100),
          @By_User int,
          @EmploymentTypeId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_EmploymentType] WHERE  [EmploymentTypeId] <> @EmploymentTypeId And [EmploymentTypeName] = @EmploymentTypeName ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_EmploymentType] 
					SET [EmploymentTypeName]=@EmploymentTypeName,[EmploymentTypeDesc]=@EmploymentTypeDesc,[By_User]=@By_User
					WHERE [EmploymentTypeId] = @EmploymentTypeId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_EmpOfficeTime]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_EmpOfficeTime]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 12 2012
	   Modify Date	: Apr 12 2012 
	   Notes	: Update_Mst_EmpOfficeTime
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @OfficeTimePolicyName Nvarchar(40),
          @LateHour numeric(6,2),
          @EarlyHour numeric(6,2),
          @DayMaxworkHour numeric(6,2),
          @PresentDuration numeric(6,2),
          @HalfDayWorkHour numeric(6,2),
          @HalfDayAbsentHour numeric(6,2),
          @RoundClock bit,
          @TimeLoss bit,
          @HalfDay bit,
          @ShortLeave bit,
          @OverStay bit,
          @OverTime bit,
          @OTRate numeric(8,2),
          @RequiredPunch smallint,
          @SinglePunchValue numeric(8,0),
          @By_User int,
          @OTimePoliceId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_EmpOfficeTime] WHERE  [OTimePoliceId] <> @OTimePoliceId And [OfficeTimePolicyName] = @OfficeTimePolicyName ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_EmpOfficeTime] 
					SET [OfficeTimePolicyName]=@OfficeTimePolicyName,[LateHour]=@LateHour,[EarlyHour]=@EarlyHour,[DayMaxworkHour]=@DayMaxworkHour,[PresentDuration]=@PresentDuration,[HalfDayWorkHour]=@HalfDayWorkHour,[HalfDayAbsentHour]=@HalfDayAbsentHour,[RoundClock]=@RoundClock,[TimeLoss]=@TimeLoss,[HalfDay]=@HalfDay,[ShortLeave]=@ShortLeave,[OverStay]=@OverStay,[OverTime]=@OverTime,[OTRate]=@OTRate,[RequiredPunch]=@RequiredPunch,[SinglePunchValue]=@SinglePunchValue,[By_User]=@By_User
					WHERE [OTimePoliceId] = @OTimePoliceId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Grade]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Grade]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Update_Mst_Grade
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @Grade_Nme Nvarchar(50),
          @Grade_Description Nvarchar(100),
          @By_User int,
          @GradeId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Grade] WHERE  [GradeId] <> @GradeId And [Grade_Nme] = @Grade_Nme ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Grade] 
					SET [Grade_Nme]=@Grade_Nme,[Grade_Description]=@Grade_Description,[By_User]=@By_User
					WHERE [GradeId] = @GradeId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Holiday]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Holiday]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Update_Mst_Holiday
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @HolidayName Nvarchar(50),
          @HolidayDate smalldatetime,
          @CompId int,
          @Description Nvarchar(100),
          @IsAdjustment bit,
          @AdjustmentDate smalldatetime,
          @By_User int,
          @HolidayId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
	if @AdjustmentDate ='01/01/1900'
		begin
			select @AdjustmentDate =null
		end	
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Holiday] WHERE  [HolidayId] <> @HolidayId And [HolidayName] = @HolidayName And [HolidayDate] = @HolidayDate And [CompId] = @CompId ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Holiday] 
					SET [HolidayName]=@HolidayName,[HolidayDate]=@HolidayDate,[CompId]=@CompId,[Description]=@Description,[IsAdjustment]=@IsAdjustment,[AdjustmentDate]=@AdjustmentDate,[By_User]=@By_User
					WHERE [HolidayId] = @HolidayId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_LeaveApplication]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_LeaveApplication]  
          @Fromdate datetime,  
          @Todate datetime,  
          @ApprovedStatus Nvarchar(25),  
          @ApprovedBy int,  
         @Remark Nvarchar(50),  
          @RwId int  
           
  
  AS   
    
  declare @leavetype Nvarchar(20)  
  declare @ltypeid int  
  declare @d1 Nvarchar(20)  
  declare @d2 Nvarchar(20)  
  declare @d3 Nvarchar(20)  
  declare @d4 Nvarchar(20)  
  declare @lvalue numeric(6,2)  
  declare @empid numeric(18,0)  
      
   select @ltypeid =leaveid,@d1=ltrim(rtrim(dur1)),@d2=ltrim(rtrim(dur2)),@d3=ltrim(rtrim(dur3)),  
    @d4=ltrim(rtrim(dur4)),@empid=empid from Mst_LeaveApplication where [RwId] =@RwId   
   
   select @leavetype =ltypecode from mst_leavetype where LeaveTypeId =@ltypeid  
      if @d1<>''  
   begin  
    select @lvalue =0.25   
   end  
   else if @d2<>''  
   begin  
    select @lvalue =0.50   
   end  
   else if @d3<>''  
   begin  
    select @lvalue =0.75   
   end  
   else if @d4<>''  
   begin  
    select @lvalue =1.0  
   end  
   else  
   begin  
    select @lvalue =1.0  
   end  
   update  Mst_LeaveApplication set  [Fromdate]=@Fromdate,[Todate]=@Todate, [ApprovedStatus]=@ApprovedStatus, [ApprovedBy]=@ApprovedBy, [ApprovedDate]=GetDate(),[Remark]=@Remark     
   where [RwId] =@RwId    
      
   if @ApprovedStatus ='Approved'  
   begin  
    Update Tran_Attendance Set LeaveCode=@leavetype,LeaveType='L',LeaveAmount=@lvalue,status=@leavetype,leavevalue=@lvalue,  
    LeaveAprDate=CAST(CONVERT(NVARCHAR(10),getdate(),101) AS SMALLDATETIME),reason =@Remark,  
    PRESENTVALUE=0,ABSENTVALUE=0,HOLIDAY_VALUE=0,WO_VALUE=0  
    Where EmpId=@empid And DateOffice between @Fromdate and @Todate  
  
   end


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_LeaveType]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_LeaveType]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Update_Mst_LeaveType
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @LTypeCode Nvarchar(20),
          @LTypeName Nvarchar(50),
          @WeekOff bit,
          @Holiday bit,
          @IsAccrual bit,
          @AccrualType Nvarchar(50),
          @Fixmin decimal(6,2),
          @Fixmax decimal(6,2),
          @CarryPresent decimal(6,2),
          @CarryLeave decimal(6,2),
          @MaxAccrual decimal(6,2),
          @Paid bit,
          @By_User int,
          @LeaveTypeId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_LeaveType] WHERE  [LeaveTypeId] <> @LeaveTypeId And [LTypeCode] = @LTypeCode ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_LeaveType] 
					SET [LTypeCode]=@LTypeCode,[LTypeName]=@LTypeName,[WeekOff]=@WeekOff,[Holiday]=@Holiday,[IsAccrual]=@IsAccrual,[AccrualType]=@AccrualType,[Fixmin]=@Fixmin,[Fixmax]=@Fixmax,[CarryPresent]=@CarryPresent,[CarryLeave]=@CarryLeave,[MaxAccrual]=@MaxAccrual,[Paid]=@Paid,[By_User]=@By_User
					WHERE [LeaveTypeId] = @LeaveTypeId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_SalaryDetail]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE      PROCEDURE [dbo].[Update_Mst_SalaryDetail]           
/*          
     Create by : Yogendra Singh          
    Create Date : Aug 11 2012          
    Modify Date : Aug 11 2012           
    Notes : Update_Mst_SalaryDetail          
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query          
*/          
          
          @EmpId numeric(18,0),          
          @Addition1 numeric(10,2),          
          @Addition2 numeric(10,2),          
          @Addition3 numeric(10,2),          
          @Addition4 numeric(10,2),          
          @Addition5 numeric(10,2),          
        
          @Addition6 numeric(10,2),          
          @Addition7 numeric(10,2),          
          @Addition8 numeric(10,2),          
          @Addition9 numeric(10,2),          
          @Addition10 numeric(10,2),         
        
          @Ded1 numeric(10,2),          
          @Ded2 numeric(10,2),          
          @Ded3 numeric(10,2),          
          @Ded4 numeric(10,2),          
          @Ded5 numeric(10,2),         
          @FDed1 numeric(10,2),          
          @FDed2 numeric(10,2),          
          @FDed3 numeric(10,2),          
          @FDed4 numeric(10,2),          
          @FDed5 numeric(10,2),          
        
          @PFNo Nvarchar(20),          
          @ESINO Nvarchar(20),          
          @IsOvertime bit,          
          @IsDayRate int ,         
       
          @IsEsi1 bit,      
          @IsPf1 bit,      
          @IsOt1 bit,      
      
          @IsEsi2 bit,      
          @IsPf2 bit,      
          @IsOt2 bit,      
      
          @IsEsi3 bit,      
          @IsPf3 bit,      
          @IsOt3 bit,      
      
          @IsEsi4 bit,      
          @IsPf4 bit,      
          @IsOt4 bit,      
      
          @IsEsi5 bit,      
          @IsPf5 bit,      
          @IsOt5 bit,      
      
          @IsEsi6 bit,      
          @IsPf6 bit,      
          @IsOt6 bit,      
      
          @IsEsi7 bit,      
          @IsPf7 bit,      
          @IsOt7 bit,      
      
          @IsEsi8 bit,      
          @IsPf8 bit,      
          @IsOt8 bit,      
      
          @IsEsi9 bit,      
          @IsPf9 bit,      
          @IsOt9 bit,      
      
      
      
          @IsEsi10 bit,      
          @IsPf10 bit,      
          @IsOt10 bit,      
    
          @PF decimal(18,2),    
          @EPF decimal(18,2),    
          @PPF decimal(18,2),    
          @ESI decimal(18,2),    
  
          @OtRate decimal(18,2),   
          @TdsAmt  decimal(18,2),   
          @TdsPer  decimal(18,2),   
          @STATUS SMALLINT OUTPUT            
          
  AS           
          
 SET NOCOUNT ON          
 DECLARE @ErrorNo INT          
           
Begin try            
           
 SELECT @STATUS=0          
            
 BEGIN TRAN btrnupdt           
          
  IF 0<(SELECT COUNT(*) FROM  [Mst_SalaryDetail] WHERE  [EmpId] <> @EmpId )               
   BEGIN          
    SELECT @STATUS =1          
    SET NOCOUNT OFF          
    COMMIT TRAN btrnupdt          
    RETURN          
   END              
  ELSE          
   BEGIN          
    UPDATE  [Mst_SalaryDetail]           
     SET [Addition1]=@Addition1,[Addition2]=@Addition2,[Addition3]=@Addition3,[Addition4]=@Addition4,[Addition5]=@Addition5,[Sub1]=@Ded1,[Sub2]=@Ded2,[Sub3]=@Ded3,[PFNo]=@PFNo,[ESINO]=@ESINO,[IsOvertime]=@IsOvertime,[IsDayRate]=@IsDayRate  ,        
     [Addition6]=@Addition6,[Addition7]=@Addition7,[Addition8]=@Addition8,[Addition9]=@Addition9,[Addition10]=@Addition10,[Sub4]=@Ded4,[Sub5]=@Ded5,        
FDed1=@FDed1,FDed2=@FDed2,FDed3=@FDed3,FDed4=@FDed4,FDed5=@FDed5  ,      
        
  IsEsi1= @IsEsi1 ,IsPf1=@IsPf1 ,IsOt1=@IsOt1 ,IsEsi2=@IsEsi2 ,IsPf2=@IsPf2 ,IsOt2=@IsOt2 ,      
IsEsi3=@IsEsi3,IsPf3=@IsPf3 ,IsOt3=@IsOt3 ,IsEsi4=@IsEsi4 ,IsPf4=@IsPf4 ,IsOt4=@IsOt4,      
 IsEsi5=@IsEsi5 ,IsPf5=@IsPf5 ,IsOt5=@IsOt5 ,IsEsi6=@IsEsi6 ,IsPf6=@IsPf6 ,IsOt6=@IsOt6 ,IsEsi7=@IsEsi7      
,IsPf7=@IsPf7 ,IsOt7=@IsOt7 ,IsEsi8=@IsEsi8 ,IsPf8=@IsPf8 ,IsOt8=@IsOt8,       IsEsi9=@IsEsi9 ,IsPf9=@IsPf9 ,IsOt9=@IsOt9 ,IsEsi10=@IsEsi10 ,IsPf10=@IsPf10 ,IsOt10=@IsOt10 ,    
PF =@PF,EPF=@EPF ,PPF=@PPF   ,ESI =@ESI ,OtRate =@OtRate ,TdsAmt=@TdsAmt,TdsPer=@TdsPer  
        
WHERE [EmpId] = @EmpId          
   END          
 COMMIT TRAN btrnupdt          
 RETURN              
          
End try          
          
BEGIN CATCH          
            
 ErrorHandler:          
 SET NOCOUNT OFF          
 SELECT @STATUS =9          
 ROLLBACK TRAN btrnupdt          
 RETURN           
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Section]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Section]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Update_Mst_Section
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @Section_Name Nvarchar(50),
          @Section_Description Nvarchar(100),
          @By_User int,
          @SectionId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Section] WHERE  [SectionId] <> @SectionId And [Section_Name] = @Section_Name ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Section] 
					SET [Section_Name]=@Section_Name,[Section_Description]=@Section_Description,[By_User]=@By_User
					WHERE [SectionId] = @SectionId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_Shift]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Mst_Shift]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 30 2012
	   Modify Date	: Mar 30 2012 
	   Notes	: Update_Mst_Shift
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @ShiftCode Nvarchar(10),
          @ShiftName Nvarchar(25),
          @StartTime numeric(6,2),
          @EndTime numeric(6,2),
          @ShiftDuration numeric(6,2),
          @Break1Begun numeric(6,2),
          @Break1End numeric(6,2),
          @Break1Duration numeric(6,2),
          @Break2Begun numeric(6,2),
          @Break2End numeric(6,2),
          @Break2Duration numeric(6,2),
         
          @By_User int,
          @ShiftId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Mst_Shift] WHERE  [ShiftId] <> @ShiftId And [ShiftCode] = @ShiftCode ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Mst_Shift] 
					SET [ShiftCode]=@ShiftCode,[ShiftName]=@ShiftName,[StartTime]=@StartTime,[EndTime]=@EndTime,[ShiftDuration]=@ShiftDuration,[Break1Begun]=@Break1Begun,[Break1End]=@Break1End,[Break1Duration]=@Break1Duration,[Break2Begun]=@Break2Begun,[Break2End]=@Break2End,[Break2Duration]=@Break2Duration,

  
[By_User]=@By_User
					WHERE [ShiftId] = @ShiftId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Mst_User]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Update_Mst_User]      
/*      
     Create by : Yogendra Singh      
    Create Date : Mar 30 2012      
    Modify Date : Mar 30 2012       
    Notes : Update_Mst_User      
   : Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query      
*/      
      
          @User_Login_Id Nvarchar(25),      
          @User_Name Nvarchar(50),      
          @User_Password Nvarchar(25),      
          @Parent_User_Id int,      
          @User_Enabled bit,      
          @email Nvarchar(50),      
          @Mobile Nvarchar(50),      
          @On_Date smalldatetime,      
          @User_Id int,      
          @per Nvarchar(200),     
          @branch_per Nvarchar(200),    
          @company_per Nvarchar(200),    
          @STATUS SMALLINT OUTPUT        
      
  AS       
      
 SET NOCOUNT ON      
 DECLARE @ErrorNo INT      
       
Begin try        
       
 SELECT @STATUS=0      
        
 BEGIN TRAN btrnupdt       
      
  IF 0<(SELECT COUNT(*) FROM  [Mst_User] WHERE  [User_Id] <> @User_Id And [User_Login_Id] = @User_Login_Id )           
   BEGIN      
    SELECT @STATUS =1      
    SET NOCOUNT OFF      
    COMMIT TRAN btrnupdt      
    RETURN      
   END          
  ELSE      
   BEGIN      
    UPDATE  [Mst_User]       
     SET [User_Login_Id]=@User_Login_Id,[User_Name]=@User_Name,[User_Password]=@User_Password,[Parent_User_Id]=@Parent_User_Id,[User_Enabled]=@User_Enabled,[email]=@email,[Mobile]=@Mobile,[On_Date]=@On_Date,[per]=@per ,branch_per=@branch_per ,Company_per=
  
@company_per    
     WHERE [User_Id] = @User_Id      
   END      
 COMMIT TRAN btrnupdt      
 RETURN          
      
End try      
      
BEGIN CATCH      
        
 ErrorHandler:      
 SET NOCOUNT OFF      
 SELECT @STATUS =9      
 ROLLBACK TRAN btrnupdt      
 RETURN       
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_MstLeaveOpening]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_MstLeaveOpening]

	@LeaveTypeId int,
	@YearNo	int,
	@Opening numeric(6,2),
    @LtypeCode Nvarchar(10),
	@STATUS SMALLINT OUTPUT

as
 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
			
 
			DELETE FROM Mst_LeaveOpening  FROM Mst_LeaveOpening A,[Temp_EmpId] B
			 WHERE A.EmpId=B.EmpId AND LeaveTypeId=@LeaveTypeId AND YearNo =@YearNo
	
				INSERT INTO [Mst_LeaveOpening]			
				([EmpId],[LeaveTypeId],[YearNo],[Opening],[LtypeCode])				
				
				SELECT distinct empid,@LeaveTypeId,@YearNo,@Opening,@LtypeCode	from 	[Temp_EmpId]	
				 
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_MstLeaveOpeningOLD]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[Update_MstLeaveOpeningOLD]

	@EmpId numeric(18,0),
	@LeaveTypeId int,
	@YearNo	int,
	@Opening numeric(6,2),
	@STATUS SMALLINT OUTPUT

as
 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
			
			DELETE FROM Mst_LeaveOpening WHERE EmpId=@EmpId AND LeaveTypeId=@LeaveTypeId AND YearNo =@YearNo
	
				INSERT INTO [Mst_LeaveOpening]			
				([EmpId],[LeaveTypeId],[YearNo],[Opening])				
				VALUES				
				(@EmpId,@LeaveTypeId,@YearNo,@Opening)				
			
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Password]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Password]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Feb 04 2012
	   Modify Date	: Feb 04 2012 
	   Notes	: Update_Mst_User
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @Password Nvarchar(50),
          @UserId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
		
	BEGIN TRAN btrnupdt	

		
			BEGIN
				UPDATE  [Mst_User] 
					SET [User_Password]=@Password
					WHERE [User_Id] = @UserId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_Tran_MachineRawPunch]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  PROCEDURE [dbo].[Update_Tran_MachineRawPunch]
/*
 	   Create by	: Raj kumar
	   Create Date	: Dec 16 2010
	   Modify Date	: dec 16 2010 
	   Notes	: Insert_Tran_MachineRawPunch
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
			  

*/         @Paycode Nvarchar(10),
          @PunchDatetime SMALLdatetime,
          @P_Day NChar(1),
          @ISManual NChar(1),
		  @Tran_MachineRawPunchId int,         
          @STATUS SMALLINT OUTPUT

	 AS 
	 
	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try  	
	
		SELECT @STATUS=0
	
	BEGIN TRAN btrn		
		IF 0<(SELECT COUNT(*) FROM  [Tran_MachineRawPunch] WHERE  [Paycode]=@Paycode and [PunchDatetime] = @PunchDatetime ) 	   
		
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrn
				RETURN
			END				
		ELSE	
		
			BEGIN		
				update  [Tran_MachineRawPunch] set
				[PunchDatetime]=@PunchDatetime,[P_Day]=@P_Day ,[ISManual]=@ISManual where [Tran_MachineRawPunchId]=@Tran_MachineRawPunchId			
						
			END	
	COMMIT TRAN btrn
	SET NOCOUNT OFF
	RETURN 		
			
End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrn
	RETURN 
END CATCH

select * from Tran_MachineRawPunch


GO
/****** Object:  StoredProcedure [dbo].[Update_Tran_MachineSetup]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_Tran_MachineSetup]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Apr 18 2012
	   Modify Date	: Apr 18 2012 
	   Notes	: Update_Tran_MachineSetup
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

          @McTypeId int,
          @TypeName Nvarchar(50),
          @PortNo int,
          @MCNo int,
          @IPAddress Nvarchar(20),
          @MCSetupId int,
          @STATUS SMALLINT OUTPUT		

	 AS 

	SET NOCOUNT ON
	DECLARE @ErrorNo	INT
	
Begin try 	
	
	SELECT @STATUS=0
	select @PortNo =PortNo from Mst_MachineType where McTypeId =@McTypeId
	
	BEGIN TRAN btrnupdt	

		IF 0<(SELECT COUNT(*) FROM  [Tran_MachineSetup] WHERE  [MCSetupId] <> @MCSetupId And [TypeName] = @TypeName And [MCNo] = @MCNo ) 	   
			BEGIN
				SELECT @STATUS =1
				SET NOCOUNT OFF
				COMMIT TRAN btrnupdt
				RETURN
			END				
		ELSE
			BEGIN
				UPDATE  [Tran_MachineSetup] 
					SET [McTypeId]=@McTypeId,[TypeName]=@TypeName,[PortNo]=@PortNo,[MCNo]=@MCNo,[IPAddress]=@IPAddress
					WHERE [MCSetupId] = @MCSetupId
			END
	COMMIT TRAN btrnupdt
	RETURN  		

End try

BEGIN CATCH
		
	ErrorHandler:
	SET NOCOUNT OFF
	SELECT @STATUS =9
	ROLLBACK TRAN btrnupdt
	RETURN 
END CATCH


GO
/****** Object:  StoredProcedure [dbo].[Update_userper]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Update_userper]
/*
 	   Create by	: Yogendra Singh
	   Create Date	: Mar 29 2012
	   Modify Date	: Mar 29 2012 
	   Notes	: Update_Mst_Department
			: Return ErrorNo --1= Record Exist,2 = Record Not Found, 9 =Error Executing Query
*/

      
          @per Nvarchar(150),
          @Userid int
         
        

	 AS 

Begin 
	update mst_user set per=@per where   User_login_id=@Userid
	
	end


GO
/****** Object:  StoredProcedure [dbo].[UpdateShiftDateRange]    Script Date: 03/19/2021 13:45:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE   PROCEDURE [dbo].[UpdateShiftDateRange]  
   
     @fromdate   smalldatetime,  
  @todate    smalldatetime,  
  @shiftCode   Nchar(3),  
  @KeywordList  NVarchar(1000)  
    
 As  
 Declare @Cntr  Int  
  Declare @Value  Int  
  Declare @Strlen  Int  
  Declare @Varmailid NVarchar(50)  
  Declare @Scanchar NVarchar(50)  
  Declare @Str  Nvarchar(300)  
  Declare @DelStatus Int   
  Declare @Keyword_Id Int  
  Declare @Instatus  int  
    
  Select @KeywordList = '|'+Ltrim(Rtrim(@KeywordList))  
   
  Select @Cntr = 0  
   
  Select @Strlen = Len(@KeywordList) + 1  
    
  truncate table  Temp_EmpId  
   
  While (@Cntr < @Strlen)  
  Begin  
   Select @Cntr = @Cntr + 1  
   
   Select @Scanchar = Substring ( @KeywordList, @Cntr ,1)    
   
   If @Scanchar = '|'  
    Begin  
     IF LTRIM(RTRIM(@Varmailid))<>''  
      BEGIN  
       UPDATE Tran_Attendance set shift =@shiftCode,ShiftAttended =@shiftCode where empid =@Varmailid and  ShiftAttended!='OFF' and 
       dateoffice between @fromdate and @todate  
      END  
     Select @Varmailid = ''    
    End  
   Else  
    Begin  
     Select @Varmailid = @Varmailid + @Scanchar  
    End     
  End


GO
